question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: gh-10882 may have broken ctypes compatibility in older versions of python

See original GitHub issue

#10882 changed the behavior of np.array from.

  • Try to get a PEP3118 buffer interface
    • Try to convert the buffer interface into an array
    • If the buffer interface is not correct, try __array_interface__ instead
    • sometimes call abort() due to bad error silencing (#6741)
  • If there’s no buffer interface, try __array_interface__ instead

To

  • Try to get a PEP3118 memory view
    • Try to convert the buffer interface into an array
    • If the buffer interface is not correct, fail and tell the user that something is wrong
  • If there’s no buffer interface, try __array_interface__ instead

This means that objects which incorrectly implement the buffer interface now fail loudly, rather than silently-or-with-abort().

Unfortunately, prior to python/cpython#31, (before 2.7.14 / 3.6.3 / 3.7.0) ctypes did not implement the buffer interface correctly for integer types (the format and itemsize didn’t match)

Do we have a minimum supported patch version of python? If so, should we enable tests for it so that this doesn’t happen again?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:16 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
eric-wiesercommented, Jun 7, 2018

I could try tweaking #10882 to have a special case for ctypes objects,

0reactions
vadimkantorovcommented, Jul 27, 2020

I also stumbled on this: I have unrelated buffer interface (inherited from ctypes impl) and my custom array_interface that I’d like to be used

Read more comments on GitHub >

github_iconTop Results From Across the Web

ctypes: fail to create a _ctypes._SimpleCData subclass using ...
While investigating a bug report in one of my libraries ... I've come across a behaviour that appears in Python 3.6 but not...
Read more >
Install via pacman to specific version of Python - Stack Overflow
You would need to make sure all the other installed packages are compatible. I am using PyInstaller with Python 3.8 in MSYS2 without...
Read more >
Homebrew, pyenv, ctypes... oh my! - DEV Community ‍ ‍
I generally use pyenv to manage Python versions, and Homebrew to ... From the broken directory, I could run make and see the...
Read more >
T84752 Crash using 'ctypes' (fixed in Python >= 3.8), causes ...
Author: Jimmy Hazevoet. Blender Version Broken: 2.91.0, branch: master, commit date: ... Can you please try to start Blender with the following command:....
Read more >
Install Python on macOS 11 M1 (Apple Silicon) using pyenv
macOS 11 comes with a default version of python2, which is now obsolete in favor of python3. Python2 reached end of life in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found