Skip to content

Commit ef0a8b5

Browse files
authored
FIX: coroutines can have a return statement (#542)
* FIX: coroutines can have a return statement The value returned by the coroutine is carried on the `StopIteration` Exception that is raised when exhausted. * CI: do not test Sphinx 7.3 * CI: also do not do sphinx 7.3.x on pre-release * CI: also do not use sphinx 7.3 on docs * STY: placate linter
1 parent defebb1 commit ef0a8b5

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
source venv/bin/activate
2222
python -m pip install --upgrade pip wheel setuptools
2323
python -m pip install --upgrade -r requirements/doc.txt
24+
python -m pip install 'sphinx!=7.3.*'
2425
python -m pip list
2526
- save_cache:
2627
key: pip-cache

.github/workflows/test.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ jobs:
1818
os: [Ubuntu]
1919
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2020
sphinx-version:
21-
["sphinx==6.0", "sphinx==6.2", "sphinx==7.0", "sphinx>=7.2"]
21+
["sphinx==6.0", "sphinx==6.2", "sphinx==7.0", "'sphinx>=7.2,<7.3'"]
22+
exclude:
23+
- python-version: "3.8"
24+
sphinx-version: "'sphinx>=7.2,<7.3'"
2225
steps:
2326
- uses: actions/checkout@v4
2427

@@ -84,6 +87,7 @@ jobs:
8487
python -m pip install --upgrade pip wheel setuptools
8588
python -m pip install --pre -r requirements/test.txt -r requirements/doc.txt
8689
python -m pip install codecov
90+
python -m pip install 'sphinx!=7.3.*'
8791
python -m pip list
8892
8993
- name: Install

numpydoc/docscrape.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,12 +394,8 @@ def _parse(self):
394394
sections = list(self._read_sections())
395395
section_names = {section for section, content in sections}
396396

397-
has_returns = "Returns" in section_names
398397
has_yields = "Yields" in section_names
399398
# We could do more tests, but we are not. Arbitrarily.
400-
if has_returns and has_yields:
401-
msg = "Docstring contains both a Returns and Yields section."
402-
raise ValueError(msg)
403399
if not has_yields and "Receives" in section_names:
404400
msg = "Docstring contains a Receives section but not Yields."
405401
raise ValueError(msg)

numpydoc/tests/test_docscrape.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,9 @@ def test_returnyield():
279279
The number of bananas.
280280
281281
"""
282-
assert_raises(ValueError, NumpyDocString, doc_text)
282+
doc = NumpyDocString(doc_text)
283+
assert len(doc["Returns"]) == 1
284+
assert len(doc["Yields"]) == 2
283285

284286

285287
def test_section_twice():

0 commit comments

Comments
 (0)