Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed
jsaporta wants to merge443 commits intopython:masterfromjsaporta:fix-issue-29847
Closed

bpo-29847: Path subclasses raise TypeError given kwargs#13399

jsaporta wants to merge443 commits intopython:masterfromjsaporta:fix-issue-29847

Conversation

@jsaporta
Copy link

@jsaportajsaporta commentedMay 18, 2019
edited by bedevere-bot
Loading

TypeError raised in the subclasses as per the discussion on bugs.python.org.

https://bugs.python.org/issue29847

@the-knights-who-say-ni

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
before our records are updated.

You cancheck yourself to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!

@jsaportajsaporta changed the titlebpo-29847: Path subclasses raise TypeError wit kwargsbpo-29847: Path subclasses raise TypeError given kwargsMay 18, 2019

def__new__(cls,*args,**kwargs):
ifkwargs:
raiseTypeError("keyword arguments provided but ignored")
Copy link
Contributor

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?

Copy link
Author

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'

__slots__= ()

def__new__(cls,*args,**kwargs):
ifkwargs:
Copy link
Contributor

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)

Copy link
Author

@jsaportajsaportaMay 18, 2019
edited
Loading

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.

@csabellacsabella requested a review frompitrouMay 18, 2019 11:34
@tirkarthi
Copy link
Member

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
Copy link
Contributor

EpicWink commentedMay 20, 2019
edited
Loading

What about a test to see if a new subclass ofpathlib.Path (orpathlib.PosixPath orpathlib.WindowsPath) can still use keyword-only parameters in the initialiser?

importpathlibclassMyPath(type(pathlib.Path())):def__init__(self,*args,foo):self.foo=foopath=MyPath('bar',foo=42)assertpath.foo==42
tirkarthi reacted with thumbs up emoji

jdemeyerand others added22 commitsMay 30, 2019 12:43
…H-8096)There is no need to clear these immutable objects during shutdown.
This reverts commit71dc7c5. Turns out you must have write access for CODEOWNERS to work.
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.
…anup. (GH-10320)TemporaryDirectory.cleanup() failed when non-writeable or non-searchablefiles or directories were created inside a temporary directory.
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
@gvanrossum
Copy link
Member

It's not cool to spam the entire team with code review requests.

@jsaporta
Copy link
Author

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?

@methane
Copy link
Member

Please use merge instead of rebase next time.
ref:python/devguide#496

@brettcannon
Copy link
Member

I'm closing this as it has 893 changed files so there's no chance to easily view what the PR is actually targeting.

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

Reviewers

@pitroupitrouAwaiting requested review from pitrou

@1st11st1Awaiting requested review from 1st1

@asvetlovasvetlovAwaiting requested review from asvetlov

@berkerpeksagberkerpeksagAwaiting requested review from berkerpeksag

@brettcannonbrettcannonAwaiting requested review from brettcannon

@encukouencukouAwaiting requested review from encukou

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrently

@ericvsmithericvsmithAwaiting requested review from ericvsmith

@gpsheadgpsheadAwaiting requested review from gpshead

@ilevkivskyiilevkivskyiAwaiting requested review from ilevkivskyi

@methanemethaneAwaiting requested review from methane

@ncoghlanncoghlanAwaiting requested review from ncoghlan

@rhettingerrhettingerAwaiting requested review from rhettinger

@skrahskrahAwaiting requested review from skrah

@terryjreedyterryjreedyAwaiting requested review from terryjreedy

1 more reviewer

@eamanueamanueamanu left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

79 participants

@jsaporta@the-knights-who-say-ni@tirkarthi@EpicWink@gvanrossum@methane@brettcannon@eamanu@paulmon@csabella@bedevere-bot@jdemeyer@ZackerySpytz@agronholm@andrewnc@ztane@xdegaye@asottile@ilevkivskyi@serhiy-storchaka@terryjreedy@tiran@pablogsal@MakDon@akshaysharma096@ammaraskar@tim-one@ericsnowcurrently@timhoffm@rkday@mariocj89@Windsooon@FR4NKESTI3N@bharel@mdickinson@matrixise@tonybaloney@franciscouzo@evanunderscore@scoder@sir-sigurd@marco-buttu@rhettinger@asvetlov@mangrisano@vstinner@encukou@Carreau@hackaugusto@cclauss@ned-deily@JulienPalard@ambv@Lothiraldan@zooba@maxking@PetterS@zware@bentyeh@epicfaace@warsaw@doerwalter@websurfer5@taleinat@eric-wieser@skrah@0x29a@flying-sheep@n0npax@ncoghlan@pitrou@aaronpaulhurst@benjaminp@laike9m@aixtools@geryogam@ubordignon@alex@shihai1991

[8]ページ先頭

©2009-2025 Movatter.jp