Skip to content

DOC: missing change in 3.0 Migration Guide? #3536

Closed

Description

@christine-e-smit

Describe the issue linked to the documentation

It looks to me as though the function signature for resize() has changed for arrays. I believe that previously, an array was resized:

z.resize(10,10)

but the new documentation says it should now be:

z.resize((10,10))

This is more consistent with how shapes are treated in things like numpy so I see why you made this change, but it doesn't seem to be captured in the 3.0 Migration Guide. Am I missing something? Or should I submit a pull request with a suggested change?

Suggested fix for documentation

Under "The Array class" section, I'd add a third bullet with the signature change.

Activity

  1. added
    help wantedIssue could use help from someone with familiarity on the topic
    documentationImprovements to the documentation
    on Oct 21, 2025
  2. d-v-b commented on Oct 22, 2025

    @d-v-b
    Contributor

    thanks for this report, I think this is information we simply failed to include in the migration guide. If you have the time to submit a fix, that would be great!

  3. christine-e-smit commented on Oct 22, 2025

    @christine-e-smit
    ContributorAuthor

    Well, I'm feeling rather incompetent right now. I have a documentation update, but:

    1. The test suite is failing with 38 failures. This happened before I made the documentation change, but I figure documentation shouldn't affect unit tests, so I'm ignoring the issue.
    2. I can't run the pre-commit hooks. When I run pre-commit run --all-files, I get a compile error. (Again, this happened before I made any changes.)

    I suspect that (1) and (2) may be related to the fact I'm on an M1 Mac or due to something about the default compiler on my system, but I'm not sure. Should I just go ahead and submit the pull request anyway? I was able to build the documentation.

    This is the build error I get with pre-commit run --all-files:

    FAILED: [code=1] numpy/_core/_multiarray_umath.cpython-314-darwin.so.p/src_umath_string_ufuncs.cpp.o
              c++ -Inumpy/_core/_multiarray_umath.cpython-314-darwin.so.p -Inumpy/_core -I../numpy/_core -Inumpy/_core/include -I../numpy/_core/include -I../numpy/_core/src/common -I../numpy/_core/src/multiarray -I../numpy/_core/src/npymath -I../numpy/_core/src/umath -I../numpy/_core/src/highway -I/Users/csmit/Software/miniconda3/envs/z_temp/include/python3.14 -I/private/var/folders/42/d2d7vt5s59nb66fky__wvwhmlr25jp/T/pip-install-0xrsfj15/numpy_41721ea57adf4033a72d5c84eb642b67/.mesonpy-qwz6kshx/meson_cpu -fvisibility=hidden -fvisibility-inlines-hidden -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -std=c++17 -O3 -ftrapping-math -DNPY_HAVE_CLANG_FPSTRICT -DNPY_HAVE_NEON_VFPV4 -DNPY_HAVE_NEON_FP16 -DNPY_HAVE_NEON -DNPY_HAVE_ASIMD -F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework -idirafter/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework/Headers -DACCELERATE_NEW_LAPACK -DHAVE_CBLAS '-DBLAS_SYMBOL_SUFFIX=$NEWLAPACK' -DNPY_INTERNAL_BUILD -DHAVE_NPY_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D__STDC_VERSION__=0 -fno-exceptions -fno-rtti -MD -MQ numpy/_core/_multiarray_umath.cpython-314-darwin.so.p/src_umath_string_ufuncs.cpp.o -MF numpy/_core/_multiarray_umath.cpython-314-darwin.so.p/src_umath_string_ufuncs.cpp.o.d -o numpy/_core/_multiarray_umath.cpython-314-darwin.so.p/src_umath_string_ufuncs.cpp.o -c ../numpy/_core/src/umath/string_ufuncs.cpp
              In file included from ../numpy/_core/src/umath/string_ufuncs.cpp:20:
              ../numpy/_core/src/umath/string_fastsearch.h:132:5: error: no type named 'ptrdiff_t' in namespace 'std'; did you mean simply 'ptrdiff_t'?
                132 |     std::ptrdiff_t
                    |     ^~~~~~~~~~~~~~
                    |     ptrdiff_t
              /Library/Developer/CommandLineTools/usr/lib/clang/17/include/__stddef_ptrdiff_t.h:18:26: note: 'ptrdiff_t' declared here
                 18 | typedef __PTRDIFF_TYPE__ ptrdiff_t;
                    |                          ^
              In file included from ../numpy/_core/src/umath/string_ufuncs.cpp:20:
              ../numpy/_core/src/umath/string_fastsearch.h:219:23: error: invalid operands to binary expression ('CheckedIndexer<char>' and 'CheckedIndexer<char>')
                219 |             return (p - s);
                    |                     ~ ^ ~
              ../numpy/_core/src/umath/string_fastsearch.h:826:20: note: in instantiation of function template specialization 'rfindchar<char>' requested here
                826 |             return rfindchar(s_, n, p_[0]);
                    |                    ^
              ../numpy/_core/src/umath/string_buffer.h:898:19: note: in instantiation of function template specialization 'fastsearch<char>' requested here
                898 |             pos = fastsearch(start_loc, end_loc - start_loc, buf2.buf, buf2.after - buf2.buf, -1, FAST_SEARCH);
                    |                   ^
              ../numpy/_core/src/umath/string_ufuncs.cpp:1453:9: note: in instantiation of function template specialization 'string_find<ENCODING::ASCII>' requested here
               1453 |         string_find<ENCODING::ASCII>,
                    |         ^
              ../numpy/_core/src/umath/string_buffer.h:720:1: note: candidate template ignored: could not match 'Buffer' against 'CheckedIndexer'
                720 | operator-(Buffer<enc> lhs, Buffer<enc> rhs)
                    | ^
              ../numpy/_core/src/umath/string_buffer.h:736:1: note: candidate template ignored: could not match 'Buffer' against 'CheckedIndexer'
                736 | operator-(Buffer<enc> lhs, npy_int64 rhs)
                    | ^
              ../numpy/_core/src/umath/string_fastsearch.h:139:5: note: candidate function not viable: no known conversion from 'CheckedIndexer<char>' to 'size_t' (aka 'unsigned long') for 1st argument
                139 |     operator-(size_t rhs)
                    |     ^         ~~~~~~~~~~
              ../numpy/_core/src/umath/string_fastsearch.h:495:27: error: invalid operands to binary expression ('CheckedIndexer<char>' and 'CheckedIndexer<char>')
                495 |             return window - haystack;
                    |                    ~~~~~~ ^ ~~~~~~~~
              ../numpy/_core/src/umath/string_fastsearch.h:576:18: note: in instantiation of function template specialization '_two_way<char>' requested here
                576 |         result = _two_way(haystack + index,
                    |                  ^
              ../numpy/_core/src/umath/string_fastsearch.h:846:24: note: in instantiation of function template specialization '_two_way_count<char>' requested here
                846 |                 return _two_way_count(s_, n, p_, m, maxcount);
                    |                        ^
              ../numpy/_core/src/umath/string_buffer.h:898:19: note: in instantiation of function template specialization 'fastsearch<char>' requested here
                898 |             pos = fastsearch(start_loc, end_loc - start_loc, buf2.buf, buf2.after - buf2.buf, -1, FAST_SEARCH);
                    |                   ^
              ../numpy/_core/src/umath/string_ufuncs.cpp:1453:9: note: in instantiation of function template specialization 'string_find<ENCODING::ASCII>' requested here
               1453 |         string_find<ENCODING::ASCII>,
                    |         ^
              ../numpy/_core/src/umath/string_buffer.h:720:1: note: candidate template ignored: could not match 'Buffer' against 'CheckedIndexer'
                720 | operator-(Buffer<enc> lhs, Buffer<enc> rhs)
                    | ^
              ../numpy/_core/src/umath/string_buffer.h:736:1: note: candidate template ignored: could not match 'Buffer' against 'CheckedIndexer'
                736 | operator-(Buffer<enc> lhs, npy_int64 rhs)
                    | ^
              ../numpy/_core/src/umath/string_fastsearch.h:139:5: note: candidate function not viable: no known conversion from 'CheckedIndexer<char>' to 'size_t' (aka 'unsigned long') for 1st argument
                139 |     operator-(size_t rhs)
                    |     ^         ~~~~~~~~~~
              ../numpy/_core/src/umath/string_fastsearch.h:219:23: error: invalid operands to binary expression ('CheckedIndexer<unsigned int>' and 'CheckedIndexer<unsigned int>')
                219 |             return (p - s);
                    |                     ~ ^ ~
              ../numpy/_core/src/umath/string_fastsearch.h:826:20: note: in instantiation of function template specialization 'rfindchar<unsigned int>' requested here
                826 |             return rfindchar(s_, n, p_[0]);
                    |                    ^
              ../numpy/_core/src/umath/string_buffer.h:908:19: note: in instantiation of function template specialization 'fastsearch<unsigned int>' requested here
                908 |             pos = fastsearch((npy_ucs4 *)start_loc, end - start,
                    |                   ^
              ../numpy/_core/src/umath/string_ufuncs.cpp:1453:9: note: in instantiation of function template specialization 'string_find<ENCODING::ASCII>' requested here
               1453 |         string_find<ENCODING::ASCII>,
                    |         ^
              ../numpy/_core/src/umath/string_buffer.h:720:1: note: candidate template ignored: could not match 'Buffer' against 'CheckedIndexer'
                720 | operator-(Buffer<enc> lhs, Buffer<enc> rhs)
                    | ^
              ../numpy/_core/src/umath/string_buffer.h:736:1: note: candidate template ignored: could not match 'Buffer' against 'CheckedIndexer'
                736 | operator-(Buffer<enc> lhs, npy_int64 rhs)
                    | ^
              ../numpy/_core/src/umath/string_fastsearch.h:139:5: note: candidate function not viable: no known conversion from 'CheckedIndexer<unsigned int>' to 'size_t' (aka 'unsigned long') for 1st argument
                139 |     operator-(size_t rhs)
                    |     ^         ~~~~~~~~~~
              ../numpy/_core/src/umath/string_fastsearch.h:495:27: error: invalid operands to binary expression ('CheckedIndexer<unsigned int>' and 'CheckedIndexer<unsigned int>')
                495 |             return window - haystack;
                    |                    ~~~~~~ ^ ~~~~~~~~
              ../numpy/_core/src/umath/string_fastsearch.h:576:18: note: in instantiation of function template specialization '_two_way<unsigned int>' requested here
                576 |         result = _two_way(haystack + index,
                    |                  ^
              ../numpy/_core/src/umath/string_fastsearch.h:846:24: note: in instantiation of function template specialization '_two_way_count<unsigned int>' requested here
                846 |                 return _two_way_count(s_, n, p_, m, maxcount);
                    |                        ^
              ../numpy/_core/src/umath/string_buffer.h:908:19: note: in instantiation of function template specialization 'fastsearch<unsigned int>' requested here
                908 |             pos = fastsearch((npy_ucs4 *)start_loc, end - start,
                    |                   ^
              ../numpy/_core/src/umath/string_ufuncs.cpp:1453:9: note: in instantiation of function template specialization 'string_find<ENCODING::ASCII>' requested here
               1453 |         string_find<ENCODING::ASCII>,
                    |         ^
              ../numpy/_core/src/umath/string_buffer.h:720:1: note: candidate template ignored: could not match 'Buffer' against 'CheckedIndexer'
                720 | operator-(Buffer<enc> lhs, Buffer<enc> rhs)
                    | ^
              ../numpy/_core/src/umath/string_buffer.h:736:1: note: candidate template ignored: could not match 'Buffer' against 'CheckedIndexer'
                736 | operator-(Buffer<enc> lhs, npy_int64 rhs)
                    | ^
              ../numpy/_core/src/umath/string_fastsearch.h:139:5: note: candidate function not viable: no known conversion from 'CheckedIndexer<unsigned int>' to 'size_t' (aka 'unsigned long') for 1st argument
                139 |     operator-(size_t rhs)
                    |     ^         ~~~~~~~~~~
              In file included from ../numpy/_core/src/umath/string_ufuncs.cpp:21:
              ../numpy/_core/src/umath/string_buffer.h:924:20: error: no matching function for call to 'string_find'
                924 |     npy_intp pos = string_find(buf1, buf2, start, end);
                    |                    ^~~~~~~~~~~
              ../numpy/_core/src/umath/string_ufuncs.cpp:1455:9: note: in instantiation of function template specialization 'string_index<ENCODING::ASCII>' requested here
               1455 |         string_index<ENCODING::ASCII>,
                    |         ^
              ../numpy/_core/src/umath/string_buffer.h:831:1: note: candidate template ignored: substitution failure [with enc = ENCODING::ASCII]
                831 | string_find(Buffer<enc> buf1, Buffer<enc> buf2, npy_int64 start, npy_int64 end)
                    | ^
              ../numpy/_core/src/umath/string_buffer.h:924:20: error: no matching function for call to 'string_find'
                924 |     npy_intp pos = string_find(buf1, buf2, start, end);
                    |                    ^~~~~~~~~~~
              ../numpy/_core/src/umath/string_ufuncs.cpp:1463:9: note: in instantiation of function template specialization 'string_index<ENCODING::UTF32>' requested here
               1463 |         string_index<ENCODING::UTF32>,
                    |         ^
              ../numpy/_core/src/umath/string_buffer.h:831:1: note: candidate template ignored: substitution failure [with enc = ENCODING::UTF32]
                831 | string_find(Buffer<enc> buf1, Buffer<enc> buf2, npy_int64 start, npy_int64 end)
                    | ^
              7 errors generated.
              [254/324] Compiling C object numpy/_core/_simd.cpython-314-darwin.so.p/src_common_npy_cpu_features.c.o
              [255/324] Compiling C object numpy/linalg/lapack_lite.cpython-314-darwin.so.p/lapack_lite_python_xerbla.c.o
              [256/324] Compiling C object numpy/linalg/lapack_lite.cpython-314-darwin.so.p/lapack_litemodule.c.o
              [257/324] Compiling C object numpy/_core/_simd.cpython-314-darwin.so.p/src__simd__simd.c.o
              [258/324] Compiling C object numpy/_core/_multiarray_umath.cpython-314-darwin.so.p/src_umath_umathmodule.c.o
              [259/324] Compiling C++ object numpy/_core/_multiarray_umath.cpython-314-darwin.so.p/src_umath_stringdtype_ufuncs.cpp.o
              [260/324] Compiling C object numpy/_core/_multiarray_umath.cpython-314-darwin.so.p/src_umath_ufunc_object.c.o
              [261/324] Compiling C++ object numpy/_core/_multiarray_umath.cpython-314-darwin.so.p/src_npysort_selection.cpp.o
              [262/324] Compiling C++ object numpy/_core/_multiarray_umath.cpython-314-darwin.so.p/src_npysort_quicksort.cpp.o
              [263/324] Compiling C++ object numpy/_core/_multiarray_umath.cpython-314-darwin.so.p/src_npysort_timsort.cpp.o
              [264/324] Compiling C++ object numpy/fft/_pocketfft_umath.cpython-314-darwin.so.p/_pocketfft_umath.cpp.o
              ninja: build stopped: subcommand failed.
              [end of output]
          
          note: This error originates from a subprocess, and is likely not a problem with pip.
        error: metadata-generation-failed
        
        × Encountered error while generating package metadata.
        ╰─> See above for output.
        
        note: This is an issue with the package mentioned above, not pip.
        hint: See above for details.
    
  4. d-v-b commented on Oct 22, 2025

    @d-v-b
    Contributor

    try using an older version of python? i see 3.14 in your traceback but 3.11 should be fine

  5. christine-e-smit commented on Oct 22, 2025

    @christine-e-smit
    ContributorAuthor

    Cool! The unit tests still failed, but the pre-commit hooks now run and everything passed, so I'll submit a pull request.

  6. christine-e-smit commented on Oct 22, 2025

    @christine-e-smit
    ContributorAuthor

    Pull request merged, so closing ticket.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements to the documentationhelp wantedIssue could use help from someone with familiarity on the topic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions