Thanks to visit codestin.com
Credit goes to github.com

Skip to content

API: Readd sctypeDict to the main namespace #24697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

mtsokol
Copy link
Member

@mtsokol mtsokol commented Sep 13, 2023

Hi @ngoldbaum,

In this PR I restored np.sctypeDict.

@ngoldbaum
Copy link
Member

Looks like the ubuntu apt mirrors are having network instability and are causing some CI failures. Going to merge now to fix the Jax CI.

@ngoldbaum ngoldbaum merged commit 76e1f8f into numpy:main Sep 13, 2023
@mtsokol mtsokol deleted the restore-sctypedict branch September 13, 2023 20:05
@jakevdp
Copy link
Contributor

jakevdp commented Sep 15, 2023

I think this also needs to be removed from __expired_attributes__ in order to be importable:

"sctypeDict": "",

@ngoldbaum
Copy link
Member

ngoldbaum commented Sep 16, 2023

I'm not able to reproduce that locally:

>>> import numpy as np
>>> np.sctypeDict
{'?': <class 'numpy.bool_'>, 0: <class 'numpy.bool_'>,...
>>> np.__version__
'2.0.0.dev0+git20230915.399c0c5'

I don't think execution goes into __getattr__ if attribute access succeeds:

# mod.py
def __getattr__(attr):
    raise AttributeError(attr)

foo = 3
>>> import mod
>>> mod.foo
3
>>> mod.bar
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nathan/mod.py", line 2, in __getattr__
    raise AttributeError(attr)
AttributeError: bar

Are you doing something different where execution ends up in the module __getattr__?

Regardless, you're right that was left behind, @mtsokol when you have a chance would you mind cleaning this up?

@mtsokol
Copy link
Member Author

mtsokol commented Sep 17, 2023

@ngoldbaum Ah yes, I forgot to remove it from the dict, but it's just unused - I will remove it in another PR.

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

Successfully merging this pull request may close these issues.

3 participants