Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-99433: Fix doctest failure on MethodWrapperType #99434

Merged
merged 1 commit into from
Dec 30, 2022

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Nov 13, 2022

Looks like it was failing because isroutine now has ismethodwrapper check. While _from_module was not having one. Refs https://github.com/python/cpython/blame/57be5459593bbd09583317ebdafc4d58ae51dbf4/Lib/inspect.py#L509

New test failure without the code change:

======================================================================
FAIL: basics (test.test_doctest.test_DocTestFinder)
Doctest: test.test_doctest.test_DocTestFinder.basics
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/Lib/doctest.py", line 2221, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for test.test_doctest.test_DocTestFinder.basics
  File "/Users/sobolev/Desktop/cpython/Lib/test/test_doctest.py", line 437, in basics

----------------------------------------------------------------------
File "/Users/sobolev/Desktop/cpython/Lib/test/test_doctest.py", line 649, in test.test_doctest.test_DocTestFinder.basics
Failed example:
    tests = doctest.DocTestFinder(exclude_empty=False).find(doctest_lineno)
Exception raised:
    Traceback (most recent call last):
      ...
    ValueError: object must be a class or function
----------------------------------------------------------------------

This would need a backport to 3.11

@sobolevn
Copy link
Member Author

@larryhastings @isidentical you work on inspect quite a lot, maybe you would have time to take a look? :)

Copy link
Contributor

@kumaraditya303 kumaraditya303 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kumaraditya303 kumaraditya303 merged commit 79c10b7 into python:main Dec 30, 2022
@miss-islington
Copy link
Contributor

Thanks @sobolevn for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-100620 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Dec 30, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 30, 2022
…ythonGH-99434)

(cherry picked from commit 79c10b7)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
miss-islington added a commit that referenced this pull request Dec 30, 2022
(cherry picked from commit 79c10b7)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants