Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
bpo-29847: Path subclasses raise TypeError given kwargs#13399
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
the-knights-who-say-ni commentedMay 18, 2019
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed thePSF contributor agreement (CLA). Our records indicate we have not received your CLA. For legal reasons we need you to sign this before we can look at your contribution. Please followthe steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You cancheck yourself to see if the CLA has been received. Thanks again for your contribution, we look forward to reviewing it! |
| def__new__(cls,*args,**kwargs): | ||
| ifkwargs: | ||
| raiseTypeError("keyword arguments provided but ignored") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
What about start the raise with uppercase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Other errors I've seen start with lowercase letters.
>>>3+'string'Traceback (mostrecentcalllast):File"<stdin>",line1,in<module>TypeError:unsupportedoperandtype(s)for+:'int'and'str'
Lib/pathlib.py Outdated
| __slots__= () | ||
| def__new__(cls,*args,**kwargs): | ||
| ifkwargs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This weird for me because if you don't have kwargs on__new__(cls, *args, **kwargs)
because this will raise a exception, what are you sending onsuper().__new__(cls, *args, **kwargs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Not sure I understand you clearly, but ifkwargs is an empty dictionary, then it will act as a falsy value in the if statement, and the exception will not be raised.
I would suggest adding a NEWS entry and perhaps a versionchanged section to doc since someone could have been passing kwargs though it was silently ignored and undocumented in the past that now raises a TypeError. |
EpicWink commentedMay 20, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
What about a test to see if a new subclass of importpathlibclassMyPath(type(pathlib.Path())):def__init__(self,*args,foo):self.foo=foopath=MyPath('bar',foo=42)assertpath.foo==42 |
…H-8096)There is no need to clear these immutable objects during shutdown.
Fix DeprecationWarning introduced inaee19f5https://bugs.python.org/issue37099
This reverts commit71dc7c5. Turns out you must have write access for CODEOWNERS to work.
As per the PEP and the [audit event raised](https://github.com/python/cpython/blob/13d4e6a4a090031f8214e058ed3c8fd47767e05f/Lib/urllib/request.py#L524) in urllib.request this should be `urllib.Request`cc:@zooba
when platform lacks a functioning sem_open implementationhttps://bugs.python.org/issue36342
Bump the removal to 3.9, indicate collections.abc available since 3.3,replace version-changed directive to deprecated-removed.https://bugs.python.org/issue36953
…yping (GH-13685)This is an old feature request that appears from time to time. After a year of experimenting with various introspection capabilities in `typing_inspect` on PyPI, I propose to add these two most commonly used functions: `get_origin()` and `get_args()`. These are essentially thin public wrappers around private APIs: `__origin__` and `__args__`.As discussed in the issue and on the typing tracker, exposing some public helpers instead of `__origin__` and `__args__` directly will give us more flexibility if we will decide to update the internal representation, while still maintaining backwards compatibility.The implementation is very simple an is essentially a copy from `typing_inspect` with one exception: `ClassVar` was special-cased in `typing_inspect`, but I think this special-casing doesn't really help and only makes things more complicated.
…async (GH-13464)Automatically replacetp_print -> tp_vectorcall_offsettp_compare -> tp_as_asynctp_reserved -> tp_as_async
It seems to be the only widget label not capitalized.
… 2. (GH-11859)Escape ``\r``, ``\0`` and ``\x1a`` (end-of-file on Windows) in Unicode strings.
The ssl module now can dump key material to a keylog file and trace TLSprotocol messages with a tracing callback. The default and stdlibcontexts also support SSLKEYLOGFILE env var.The msg_callback and related enums are private members. The featureis designed for internal debugging and not for end users.Signed-off-by: Christian Heimes <christian@python.org>
If a type's __ipow__ method was implemented in C, attempting to usethe *modulo* parameter would cause crashes.https://bugs.python.org/issue36379
It's not cool to spam the entire team with code review requests. |
I synced my fork with master then rebased the issue branch on top of it before updating it. Looks like that may have been a mistake? |
Please use merge instead of rebase next time. |
I'm closing this as it has 893 changed files so there's no chance to easily view what the PR is actually targeting. |
Uh oh!
There was an error while loading.Please reload this page.
TypeError raised in the subclasses as per the discussion on bugs.python.org.
https://bugs.python.org/issue29847