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 — bpo-29847: Path subclasses raise TypeError given kwargs by jsaporta · Pull Request #13399 · python/cpython

Conversation

@jsaporta

@jsaporta jsaporta commented May 18, 2019 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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

https://bugs.python.org/issue29847

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@the-knights-who-say-ni

the-knights-who-say-ni commented May 18, 2019

Copy link
Copy Markdown

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 the PSF 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 follow the 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 can check yourself to see if the CLA has been received.

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@the-knights-who-say-ni the-knights-who-say-ni added the CLA not signed label May 18, 2019
@bedevere-bot bedevere-bot added the awaiting review label May 18, 2019
@jsaporta jsaporta changed the title bpo-29847: Path subclasses raise TypeError wit kwargs bpo-29847: Path subclasses raise TypeError given kwargs May 18, 2019
eamanu
eamanu reviewed May 18, 2019
View reviewed changes
Comment thread Lib/pathlib.py

def __new__(cls, *args, **kwargs):
if kwargs:
raise TypeError("keyword arguments provided but ignored")

@eamanu eamanu May 18, 2019

Copy link
Copy Markdown
Contributor

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jsaporta jsaporta May 18, 2019

Copy link
Copy Markdown
Author

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 (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/pathlib.py Outdated
__slots__ = ()

def __new__(cls, *args, **kwargs):
if kwargs:

@eamanu eamanu May 18, 2019

Copy link
Copy Markdown
Contributor

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 on super().__new__(cls, *args, **kwargs)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jsaporta jsaporta May 18, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

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 if kwargs is an empty dictionary, then it will act as a falsy value in the if statement, and the exception will not be raised.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@csabella
csabella requested a review from pitrou May 18, 2019 11:34
@tirkarthi

tirkarthi commented May 18, 2019

Copy link
Copy Markdown
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@EpicWink

EpicWink commented May 20, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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

import pathlib
class MyPath(type(pathlib.Path())):
    def __init__(self, *args, foo):
        self.foo = foo
path = MyPath('bar', foo=42)
assert path.foo == 42
tirkarthi reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jdemeyer and others added 22 commits May 30, 2019 12:43
@jdemeyer @encukou
bpo-36974: inherit the vectorcall protocol (GH-13498)
735e8af
@jdemeyer @encukou
bpo-36974: remove _PyObject_HasFastCall (GH-13460)
c145f3b
@ZackerySpytz @encukou
bpo-20602: Do not clear sys.flags and sys.float_info during shutdown (G…
249b7d5
…H-8096)

There is no need to clear these immutable objects during shutdown.
@tirkarthi @miss-islington
bpo-37099: Silence DeprecationWarning in test_inspect (GH-13679)
6d0b747
Fix DeprecationWarning introduced in aee19f5


https://bugs.python.org/issue37099
@jdemeyer @encukou
bpo-36974: rename _FastCallKeywords -> _Vectorcall (GH-13653)
37788bc
@brettcannon @miss-islington
Revert adding @maxking to CODEOWNERS file (GH-13660)
25ee0c3
This reverts commit 71dc7c5. Turns out you must have write access for CODEOWNERS to work.
@agronholm @miss-islington
bpo-36999: Add asyncio.Task.get_coro() (GH-13680)
98ef920
https://bugs.python.org/issue36999
@tirkarthi @miss-islington
Fix audit event typo : urllib.request -> urllib.Request (GH-13550)
1b69c09
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
@andrewnc @miss-islington
bpo-5028: fix doc bug for tokenize (GH-11683)
1e36f75
https://bugs.python.org/issue5028
@ztane @csabella
bpo-30969: Fix docs about the comparison in absence of __contains__ (G…
2f5b9dc
…H-2761)
@xdegaye @miss-islington
bpo-36342: Fix test_multiprocessing in test_venv (GH-12513)
5437ccc
when platform lacks a functioning sem_open implementation



https://bugs.python.org/issue36342
Matthias Bussonnier @miss-islington
bpo-36953: Delay removal of ABCs from collections. (GH-13409)
eea47e0
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
@asottile @miss-islington
bpo-5028: Fix up rest of documentation for tokenize documenting line (G…
2a58b06
…H-13686)

https://bugs.python.org/issue5028
@ilevkivskyi
bpo-29262: Add get_origin() and get_args() introspection helpers to t…
4c23aff
…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.
@jdemeyer @benjaminp
bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_…
530f506
…async (GH-13464)

Automatically replace
tp_print -> tp_vectorcall_offset
tp_compare -> tp_as_async
tp_reserved -> tp_as_async
@serhiy-storchaka
bpo-339827: Do not swallow exceptions in the _ssl module. (GH-12756)
65fb2c0
@serhiy-storchaka
bpo-36548: Improve the repr of re flags. (GH-12715)
14a0e16
@terryjreedy
IDLE - Capitalize search dialogs' 'Close' button label. (#13691)
ba04302
It seems to be the only widget label not capitalized.
@serhiy-storchaka
bpo-31829: Make protocol 0 pickles be loadable in text mode in Python…
38ab7d4
… 2. (GH-11859)

Escape ``\r``, ``\0`` and ``\x1a`` (end-of-file on Windows) in Unicode strings.
@serhiy-storchaka
bpo-26660, bpo-35144: Fix permission errors in TemporaryDirectory cle…
e9b51c0
…anup. (GH-10320)

TemporaryDirectory.cleanup() failed when non-writeable or non-searchable
files or directories were created inside a temporary directory.
@tiran
bpo-34271: Add ssl debugging helpers (GH-10031)
c7f7069
The ssl module now can dump key material to a keylog file and trace TLS
protocol messages with a tracing callback. The default and stdlib
contexts also support SSLKEYLOGFILE env var.

The msg_callback and related enums are private members. The feature
is designed for internal debugging and not for end users.

Signed-off-by: Christian Heimes <[email protected]>
@ZackerySpytz @miss-islington
bpo-36379: __ipow__ must be a ternaryfunc, not a binaryfunc (GH-13546)
c7f803b
If a type's __ipow__ method was implemented in C, attempting to use
the *modulo* parameter would cause crashes.


https://bugs.python.org/issue36379
@jsaporta
jsaporta requested review from a team, brettcannon, encukou, ericsnowcurrently, ericvsmith, gpshead, gvanrossum, ilevkivskyi, methane, ncoghlan, rhettinger, skrah, terryjreedy, tiran and warsaw as code owners June 17, 2019 03:25
@gvanrossum
gvanrossum removed request for a team, gvanrossum, tiran and warsaw June 17, 2019 03:26
@gvanrossum

gvanrossum commented Jun 17, 2019

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jsaporta

jsaporta commented Jun 17, 2019

Copy link
Copy Markdown
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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@methane

methane commented Jun 17, 2019

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brettcannon

brettcannon commented Jun 18, 2019

Copy link
Copy Markdown
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brettcannon brettcannon closed this Jun 18, 2019
@JelleZijlstra JelleZijlstra mentioned this pull request Oct 10, 2022
Path takes and ignores **kwargs #74033
Closed
@coderabbitai coderabbitai Bot mentioned this pull request Aug 10, 2026
refactor(auth): extract storage object model and migrate callers teng-lin/notebooklm-py#2171
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pitrou pitrou Awaiting requested review from pitrou
@1st1 1st1 Awaiting requested review from 1st1
@asvetlov asvetlov Awaiting requested review from asvetlov
@berkerpeksag berkerpeksag Awaiting requested review from berkerpeksag
@brettcannon brettcannon Awaiting requested review from brettcannon
@encukou encukou Awaiting requested review from encukou
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently
@ericvsmith ericvsmith Awaiting requested review from ericvsmith
@gpshead gpshead Awaiting requested review from gpshead
@ilevkivskyi ilevkivskyi Awaiting requested review from ilevkivskyi
@methane methane Awaiting requested review from methane
@ncoghlan ncoghlan Awaiting requested review from ncoghlan
@rhettinger rhettinger Awaiting requested review from rhettinger
@skrah skrah Awaiting requested review from skrah
@terryjreedy terryjreedy Awaiting requested review from terryjreedy
1 more reviewer
@eamanu eamanu eamanu left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

19 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — 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.