Skip to content

Conversation

The underlying problem is that classes monkey-patched via
new.instancemethod will only free memory correctly if they do _not_
implement the __del__ method, which is not the case for gzip.GzipFile.

My proposed solution is to inherit from gzip.GzipFile and override
relevant methods instead of monkey-patching.
@fabianp
Copy link
Author

fabianp commented Nov 18, 2010

Committed in f26fdc9

mattip referenced this pull request in mattip/numpy Mar 20, 2019
bashtage referenced this pull request in bashtage/numpy May 16, 2019
ENH: Add closed generator to randint
fangerer referenced this pull request in hpyproject/numpy-hpy Jul 7, 2022
Merge in numpy-hpy from ss/array_array3 to labs-hpy-port

* commit 'a197852c5099cec81ed8cdfde0a59a29316db2a3':
  hpy_raw_array_assign_scalar
  HPyArray_AssignRawScalar and HPyArray_EquivTypes
luyahan referenced this pull request in plctlab/numpy Apr 25, 2024
amane-ame added a commit to amane-ame/numpy that referenced this pull request Jun 19, 2025
…hway (numpy#15)

* ENH, SIMD: Initial implementation of Highway wrapper

A thin wrapper over Google's Highway SIMD library to simplify its interface.
This commit provides the implementation of that wrapper, consisting of:

- simd.hpp: Main header defining the SIMD namespaces and configuration
- simd.inc.hpp: Template header included multiple times with different namespaces

The wrapper eliminates Highway's class tags by:
- Using lane types directly which can be deduced from arguments
- Leveraging namespaces (np::simd and np::simd128) for different register widths

A README is included to guide usage and document design decisions.

* SIMD: Update wrapper with improved docs and type support

  - Fix hardware/platform terminology in documentation for clarity
  - Add support for long double in template specializations
  - Add kMaxLanes constant to expose maximum vector width information
  - Follows clang formatting style for consistency with NumPy codebase.

* SIMD: Improve isolation and constexpr handling in wrapper

  - Add anonymous namespace around implementation to ensure each
    translation unit gets its own constants based on local flags
  - Use HWY_LANES_CONSTEXPR for Lanes function to ensure proper
    constexpr evaluation across platforms

* Update Highway submodule to latest master

* SIMD: Fix compile error by using MaxLanes instead of Lanes for array size

  Replace hn::Lanes(f64) with hn::MaxLanes(f64) when defining the index array
  size to fix error C2131: "expression did not evaluate to a constant". This error
  occurs because Lanes() isn't always constexpr compatible, especially with
  scalable vector extensions. MaxLanes() provides a compile-time constant value
  suitable for static array allocation and should be used with non-scalable SIMD
  extensions when defining fixed-size arrays.

* Convert unary_fp_le to highway.

---------

Co-authored-by: Sayed Adel <[email protected]>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant