Title: bpo-41109: subclasses of pathlib.Path and pathlib.PurePath now call the subclass's __init__() and __new__() functions when returning new objects by websurfer5 · Pull Request #21920 · python/cpython · GitHub
Open Graph Title: bpo-41109: subclasses of pathlib.Path and pathlib.PurePath now call the subclass's __init__() and __new__() functions when returning new objects by websurfer5 · Pull Request #21920 · python/cpython
X Title: bpo-41109: subclasses of pathlib.Path and pathlib.PurePath now call the subclass's __init__() and __new__() functions when returning new objects by websurfer5 · Pull Request #21920 · python/cpython
Description: Several pathlib.Path and pathlib.PurePath return new Path and PurePath objects. A subclass of one of those classes returns objects that are instances of the subclass, but the subclass's new() and init() functions are not called. A subclass has to override Path._init() or PurePath._init() to perform custom initialization for these returned objects in addition to its init() function. This patch reworks the Path and PurePath object creation processes to ensure that the new() and init() functions in subclasses get called. It moves the object creation process from PurePath._from_parts() and PurePath._from_parsed_parts() to PurePath.init() and Path.init(), and marks the two functions with deprecation warnings. https://bugs.python.org/issue41109
Open Graph Description: Several pathlib.Path and pathlib.PurePath return new Path and PurePath objects. A subclass of one of those classes returns objects that are instances of the subclass, but the subclass's new() ...
X Description: Several pathlib.Path and pathlib.PurePath return new Path and PurePath objects. A subclass of one of those classes returns objects that are instances of the subclass, but the subclass's ne...
Opengraph URL: https://github.com/python/cpython/pull/21920
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:abee162f-e1a7-74ec-38e4-23d8975f378a |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | 97D6:2004F6:3367D3:4463C5:69697BAB |
| html-safe-nonce | 20e0797bd8b513610ac09936a5442ca48215ffa098a931972711aa4ed2ee9160 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5N0Q2OjIwMDRGNjozMzY3RDM6NDQ2M0M1OjY5Njk3QkFCIiwidmlzaXRvcl9pZCI6IjM1NTA1NTA2MDgxMDk0Njg1ODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1234ecc300f8b71e9c9f9755a814f8282d3d82ae428316ac4f9081279e7a7c2b |
| hovercard-subject-tag | pull_request:469930819 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/21920/checks |
| twitter:image | https://avatars.githubusercontent.com/u/49998481?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/49998481?s=400&v=4 |
| og:image:alt | Several pathlib.Path and pathlib.PurePath return new Path and PurePath objects. A subclass of one of those classes returns objects that are instances of the subclass, but the subclass's new() ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | f33e4b94c8824ab2b434d82a94139432fb5ebee9df4b75304140ad22508c4a77 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 48f380098b30acbb700b04f1724481ca10d574fc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width