Skip to content

bpo-46417: Add missing types of _PyTypes_InitTypes() - #30749

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:init_types
Jan 21, 2022
Merged

vstinner merged 1 commit into
python:mainfrom
vstinner:init_types

Conversation

@vstinner

@vstinner vstinner commented Jan 21, 2022 •

Copy link
Copy Markdown
Member

Add types removed by mistake by the commit adding
_PyTypes_FiniTypes().

Move also PyBool_Type at the end, since it depends on PyLong_Type.

PyBytes_Type and PyUnicode_Type no longer depend explicitly on
PyBaseObject_Type: it's the default of PyType_Ready().

https://bugs.python.org/issue46417

@vstinner

Copy link
Copy Markdown
Member Author

This change doesn't fix the crash, Ubuntu failed on Azure Pipelines PR:

test_mock_add_spec (unittest.test.testmock.testmock.MockTest) ... Fatal Python error: Segmentation fault

Current thread 0x00007fda98424280 (most recent call first):
  File "/home/vsts/work/1/s/Lib/inspect.py", line 2179 in _signature_fromstr
  File "/home/vsts/work/1/s/Lib/inspect.py", line 2273 in _signature_from_builtin
  File "/home/vsts/work/1/s/Lib/inspect.py", line 2461 in _signature_from_callable
  File "/home/vsts/work/1/s/Lib/inspect.py", line 2465 in _signature_from_callable
  File "/home/vsts/work/1/s/Lib/inspect.py", line 2966 in from_callable
  File "/home/vsts/work/1/s/Lib/inspect.py", line 3218 in signature
  File "/home/vsts/work/1/s/Lib/unittest/mock.py", line 112 in _get_signature_object
  File "/home/vsts/work/1/s/Lib/unittest/mock.py", line 505 in _mock_add_spec
  File "/home/vsts/work/1/s/Lib/unittest/mock.py", line 487 in mock_add_spec
  File "/home/vsts/work/1/s/Lib/unittest/test/testmock/testmock.py", line 1781 in test_mock_add_spec
...

I wrote a different change: PR #30750.

Add types removed by mistake by the commit adding
_PyTypes_FiniTypes().

Move also PyBool_Type at the end, since it depends on PyLong_Type.

PyBytes_Type and PyUnicode_Type no longer depend explicitly on
PyBaseObject_Type: it's the default of PyType_Ready().
@vstinner

Copy link
Copy Markdown
Member Author

I wrote a different change: PR #30750.

PR #30750 is merged. I rebase this PR to top of it to see if it does fix the test_unittest crash.

@vstinner
vstinner merged commit a1bf329 into python:main Jan 21, 2022
@vstinner
vstinner deleted the init_types branch January 21, 2022 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants