GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BUG: static typing of numpy.clip seems to be missing some kwargs · Issue #24391 · numpy/numpy

BUG: static typing of numpy.clip seems to be missing some kwargs #24391

New issue
Copy link
New issue
Copy link
Closed
#24611
Closed
BUG: static typing of numpy.clip seems to be missing some kwargs#24391
#24611
Copy link
Labels
00 - Bug41 - Static typing

Description

@pedro-w
pedro-w
opened on Aug 11, 2023
Issue body actions

Describe the issue:

Using the 'basic type checking' option in VS code I see an error flagged on a numpy call which I believe to be incorrect. I originally posted a bug for pyright and they told me to ask here, as VS code's typing info for numpy comes from the project itself.

Reproduce the code example:

import numpy

numpy.clip(numpy.zeros(1), 0, 255, casting='safe')

Error message:

No overloads for "clip" match the provided arguments
    Argument types: (NDArray[float64], Literal[0], Literal[255], Literal['safe'])

Runtime information:

1.25.2
3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]
WARNING: `threadpoolctl` not found in system! Install it by `pip install threadpoolctl`. Once installed, try `np.show_runtime` again for more detailed build information
[{'numpy_version': '1.25.2',
  'python': '3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 '
            '64 bit (AMD64)]',
  'uname': uname_result(system='Windows', node='LAPTOP', release='10', version='10.0.22621', machine='AMD64')},
 {'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
                      'found': ['SSSE3',
                                'SSE41',
                                'POPCNT',
                                'SSE42',
                                'AVX',
                                'F16C',
                                'FMA3',
                                'AVX2'],
                      'not_found': ['AVX512F',
                                    'AVX512CD',
                                    'AVX512_SKX',
                                    'AVX512_CLX',
                                    'AVX512_CNL',
                                    'AVX512_ICL']}}]
None

Context for the issue:

This issue is cosmetic in the sense that the code will run correctly even if the error shows in the editor.

However if you agree that it looks like the root cause is in the numpy project, I am happy to do a bit more investigation to see if it affects other ufuncs and other keyword args, and hopefully generate a PR to fix everything.

Activity

  1. pedro-w
    added
    00 - Bug
    on Aug 11, 2023
  2. charris
    added
    41 - Static typing
    on Aug 11, 2023
  3. BvB93 commented on Sep 1, 2023

    @BvB93
    BvB93
    on Sep 1, 2023
    Member
    More actions

    Very much agreed yes. It's a small issue but one that can (and should) be easily fixed.
    See #24611.

  4. charris
    closed this as completedin #24611on Sep 1, 2023
  5. pedro-w commented on Sep 1, 2023

    @pedro-w
    pedro-w
    on Sep 1, 2023
    Author
    More actions

    Thank you very much for fixing this. Is clip the only function affected though, might there be more?

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

    00 - Bug41 - Static typing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.