GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-103092: Test `_ctypes` type hierarchy and features by aisk · Pull Request #113727 · python/cpython

Conversation

@aisk

@aisk aisk commented Jan 5, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This change is related to #113620 (review), to test the compatibility before and after it.

All classes with metatypes (which have changed in #113620) are tested, plus CField. Other classes are hard to test (can't be accessed in Python easily), or Windows related (I'm not using Windows now), I think it's better to add tests to test them in another PR.

@erlend-aasland

  • Issue: Isolate Stdlib Extension Modules #103092

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
aisk added 3 commits January 5, 2024 01:04
@aisk
add inheritance hierarchy and other tests for ctypes base types
1d95bbc
@aisk
add tests for cfuncptr
6df089c
@aisk
add tests for CField
81802ae
@bedevere-app bedevere-app Bot added tests Tests in the Lib/test dir awaiting review labels Jan 5, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Jan 5, 2024
Isolate Stdlib Extension Modules #103092
Closed
24 of 25 tasks
@erlend-aasland erlend-aasland added the skip news label Jan 5, 2024
aisk
aisk commented Jan 5, 2024
View reviewed changes
Comment thread Lib/test/test_ctypes/test_struct_fields.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

aisk
aisk commented Jan 5, 2024
View reviewed changes
Comment thread Lib/test/test_ctypes/test_unions.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@aisk
add test for COMError
a8b4d32
@erlend-aasland erlend-aasland changed the title gh-103092: add tests for ctypes to maintain compatibility after isolating it gh-103092: Tests _ctypes type hierarchy and features Jan 6, 2024
erlend-aasland
erlend-aasland reviewed Jan 6, 2024
View reviewed changes
Comment thread Lib/test/test_ctypes/test_arrays.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland
erlend-aasland reviewed Jan 6, 2024
View reviewed changes
Comment thread Lib/test/test_ctypes/test_arrays.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

aisk added 4 commits January 9, 2024 00:18
@aisk
add support.py to export ctypes hidden types
e48efc3
@aisk
change to check the type's mutablility by type.__flags__
0cd6f88
@aisk
fix assert in support.py
b031cc9
@aisk
change more test to check the type.__flags__
1e7c064
erlend-aasland
erlend-aasland reviewed Jan 8, 2024
View reviewed changes
Comment thread Lib/test/test_ctypes/support.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_ctypes/test_arrays.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_ctypes/test_struct_fields.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

aisk and others added 6 commits January 9, 2024 20:23
@aisk @erlend-aasland
Update Lib/test/test_ctypes/support.py
d843763
Co-authored-by: Erlend E. Aasland <[email protected]>
@aisk
rename type flag symbol name
8636250
@aisk
move CField to support.py
6a0676c
@aisk
test the type flags with sub test
37aecd4
@aisk
rename support.py to _support.py to avoid ambiguous when import
3ccb964
@aisk
align the import statement
0ac92f0
@aisk

aisk commented Jan 9, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Thanks for the review. All issues mentioned in the comments above should now be fixed.

And I renamed support.py to _support.py, otherwise it will cause an ambiguous import when running with -R : argument:

Traceback (most recent call last):
  File "C:\Users\xxxxx\Source\cpython\Lib\unittest\loader.py", line 113, in loadTestsFromModule
    return load_tests(self, tests, pattern)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xxxxx\Source\cpython\Lib\test\test_ctypes\__init__.py", line 10, in load_tests
    return support.load_package_tests(os.path.dirname(__file__), *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'test.test_ctypes.support' has no attribute 'load_package_tests'
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aisk

aisk commented Jan 9, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Lots of CIs have failed, seems to be related to GitHub's internal error, and this page often returns 500. I think we should re-run the CI after GitHub fixes the server error.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland
erlend-aasland reviewed Jan 9, 2024
View reviewed changes
Comment thread Lib/test/test_ctypes/test_arrays.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

aisk and others added 2 commits January 9, 2024 22:48
@aisk @erlend-aasland
Update Lib/test/test_ctypes/test_arrays.py
efd0d9f
Co-authored-by: Erlend E. Aasland <[email protected]>
@aisk
refactor the type flags check
2660e86
erlend-aasland
erlend-aasland approved these changes Jan 9, 2024
View reviewed changes
@erlend-aasland erlend-aasland changed the title gh-103092: Tests _ctypes type hierarchy and features gh-103092: Test _ctypes type hierarchy and features Jan 9, 2024
@erlend-aasland
erlend-aasland merged commit be89ee5 into python:main Jan 9, 2024
@bedevere-app bedevere-app Bot removed the awaiting review label Jan 9, 2024
@aisk
aisk deleted the more-ctypes-tests branch January 9, 2024 17:31
kulikjak pushed a commit to kulikjak/cpython that referenced this pull request Jan 22, 2024
@aisk @erlend-aasland @kulikjak
pythongh-103092: Test _ctypes type hierarchy and features (python#113727
2fc7862
)

Test the following features for _ctypes types:
- disallow instantiation
- inheritance (MRO)
- immutability
- type name

The following _ctypes types are tested:
- Array
- CField
- COMError
- PyCArrayType
- PyCFuncPtrType
- PyCPointerType
- PyCSimpleType
- PyCStructType
- Structure
- Union
- UnionType
- _CFuncPtr
- _Pointer
- _SimpleCData

Co-authored-by: Erlend E. Aasland <[email protected]>
aisk added a commit to aisk/cpython that referenced this pull request Feb 11, 2024
@aisk @erlend-aasland
pythongh-103092: Test _ctypes type hierarchy and features (python#113727
62cf5ab
)

Test the following features for _ctypes types:
- disallow instantiation
- inheritance (MRO)
- immutability
- type name

The following _ctypes types are tested:
- Array
- CField
- COMError
- PyCArrayType
- PyCFuncPtrType
- PyCPointerType
- PyCSimpleType
- PyCStructType
- Structure
- Union
- UnionType
- _CFuncPtr
- _Pointer
- _SimpleCData

Co-authored-by: Erlend E. Aasland <[email protected]>
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@aisk @erlend-aasland @Glyphack
pythongh-103092: Test _ctypes type hierarchy and features (python#113727
541a914
)

Test the following features for _ctypes types:
- disallow instantiation
- inheritance (MRO)
- immutability
- type name

The following _ctypes types are tested:
- Array
- CField
- COMError
- PyCArrayType
- PyCFuncPtrType
- PyCPointerType
- PyCSimpleType
- PyCStructType
- Structure
- Union
- UnionType
- _CFuncPtr
- _Pointer
- _SimpleCData

Co-authored-by: Erlend E. Aasland <[email protected]>
@encukou encukou mentioned this pull request Oct 28, 2024
[3.12] gh-125783: Add tests to prevent regressions with the combination of ctypes and metaclasses. (GH-125881) #125988
Merged
encukou pushed a commit to miss-islington/cpython that referenced this pull request Oct 28, 2024
@aisk @erlend-aasland @encukou
Add test_ctypes/_support.py
dd7600e
This partially backports be89ee5
(python#113727)

Co-authored-by: Erlend E. Aasland <[email protected]>
encukou pushed a commit that referenced this pull request Oct 29, 2024
@miss-islington @junkmd
@aisk @erlend-aasland
[3.12] gh-125783: Add tests to prevent regressions with the combinati…
bce9df9
…on of `ctypes` and metaclasses. (GH-125881) (GH-125988)

cherry picked from commit 1384409
by Jun Komoda

Also: Add test_ctypes/_support.py from 3.13+
This partially backports be89ee5
(#113727)
by AN Long


Co-authored-by: Jun Komoda <[email protected]>
Co-authored-by: AN Long <[email protected]>
Co-authored-by: Erlend E. Aasland <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@erlend-aasland erlend-aasland erlend-aasland approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@aisk @erlend-aasland
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.