8000 gh-80480: Emit DeprecationWarning for array's 'u' type code by hugovk · Pull Request #95760 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-80480: Emit DeprecationWarning for array's 'u' type code #95760

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

Merged
merged 14 commits into from
Jun 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move 'u' test to own method
  • Loading branch information
hugovk committed Jun 6, 2023
commit 6e7bff63c593afd4c1f5983ed117cb54a76cd38b
16 changes: 9 additions & 7 deletions Lib/test/test_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3184,7 +3184,6 @@ def cmptest(testcase, a, b, m, singleitem):
self.assertEqual(m.tobytes(), a.tobytes())
cmptest(self, a, b, m, singleitem)

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-80480 array('u')
def test_memoryview_compare_special_cases(self):

a = array.array('L', [1, 2, 3])
Expand Down Expand Up @@ -3219,12 +3218,6 @@ def test_memoryview_compare_special_cases(self):
nd[0] = (-1, float('nan'))
self.assertNotEqual(memoryview(nd), nd)

# Depends on issue #15625: the struct module does not understand 'u'.
a = array.array('u', 'xyz')
v = memoryview(a)
self.assertNotEqual(a, v)
self.assertNotEqual(v, a)

# Some ctypes format strings are unknown to the struct module.
if ctypes:
# format: "T{>l:x:>l:y:}"
Expand All @@ -3238,6 +3231,15 @@ class BEPoint(ctypes.BigEndianStructure):
self.assertNotEqual(point, a)
self.assertRaises(NotImplementedError, a.tolist)

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-80480 array('u')
def test_memoryview_compare_special_cases_deprecated_u_type_code(self):

# Depends on issue #15625: the struct module does not understand 'u'.
a = array.array('u', 'xyz')
v = memoryview(a)
self.assertNotEqual(a, v)
self.assertNotEqual(v, a)

def test_memoryview_compare_ndim_zero(self):

nd1 = ndarray(1729, shape=[], format='@L')
Expand Down
0