Skip to content

Instantly share code, notes, and snippets.

@timmc-edx
Created May 9, 2025 17:35
Show Gist options
  • Save timmc-edx/2aeb7aa338dcf682eab573d333327bef to your computer and use it in GitHub Desktop.
Save timmc-edx/2aeb7aa338dcf682eab573d333327bef to your computer and use it in GitHub Desktop.
Issue discovered in upgrade from 3.8/quince to 3.12/teak

numpy 1.24.0 removed type aliases

numpy deprecated type aliases like np.complex in 1.20.0 and removed them entirely in 1.24.0.

Finding examples of this in code with a regular expression: \b(np|numpy)\.(complex|bool|int|float|object|str|unicode|long)\b

Any reference to np.complex should be replaced simply with complex. Same for bool, int, float, object, and str. Some have different names: np.unicode becomes str and np.long becomes int. More information here: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Python 3.11 removed inspect.getargspec

This function was deprecated in Python 3.0 and removed in 3.11. The replacement is getfullargspec but it’s not necessarily a straight drop-in – depends on how it is being used.

Calls to inspect.getargspec where only the args part of the return value is used can be replaced with: (args, *_) = inspect.getfullargspec(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment