René's URL Explorer Experiment


Title: list is not equivalent to typing.List under combination of generics and futures · Issue #6130 · pydantic/pydantic · GitHub

Open Graph Title: list is not equivalent to typing.List under combination of generics and futures · Issue #6130 · pydantic/pydantic

X Title: list is not equivalent to typing.List under combination of generics and futures · Issue #6130 · pydantic/pydantic

Description: Initial Checks I have searched GitHub for a duplicate issue and I'm sure this is something new I have searched Google & StackOverflow for a solution and couldn't find anything I have read and followed the docs and still think this is a b...

Open Graph Description: Initial Checks I have searched GitHub for a duplicate issue and I'm sure this is something new I have searched Google & StackOverflow for a solution and couldn't find anything I have read and follo...

X Description: Initial Checks I have searched GitHub for a duplicate issue and I'm sure this is something new I have searched Google & StackOverflow for a solution and couldn't find anything I have re...

Opengraph URL: https://github.com/pydantic/pydantic/issues/6130

X: @github

direct link

Domain: redirect.github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"list is not equivalent to typing.List under combination of generics and futures","articleBody":"### Initial Checks\n\n- [X] I have searched GitHub for a duplicate issue and I'm sure this is something new\n- [X] I have searched Google & StackOverflow for a solution and couldn't find anything\n- [X] I have read and followed [the docs](https://docs.pydantic.dev) and still think this is a bug\n- [X] I am confident that the issue is with pydantic (not my code, or another library in the ecosystem like [FastAPI](https://fastapi.tiangolo.com) or [mypy](https://mypy.readthedocs.io/en/stable))\n\n\n### Description\n\nThis is a strange one - under the below conditions, exchanging `typing.List` for the more modern `list` produces the below error. I can't reproduce in a simpler example than this - it looks to me like a bug in pydantic:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"pydantic/validators.py\", line 751, in pydantic.validators.find_validators\r\nTypeError: issubclass() arg 1 must be a class\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"{path_to_test}/test.py\", line 11, in \u003cmodule>\r\n    outer = Outer[\"Inner\"]\r\n  File \"{path_to_pydantic}/pydantic/generics.py\", line 163, in __class_getitem__\r\n    _prepare_model_fields(created_model, fields, instance_type_hints, typevars_map)\r\n  File \"{path_to_pydantic}/pydantic/generics.py\", line 389, in _prepare_model_fields\r\n    field.prepare()\r\n  File \"pydantic/fields.py\", line 552, in pydantic.fields.ModelField.prepare\r\n  File \"pydantic/fields.py\", line 758, in pydantic.fields.ModelField._type_analysis\r\n  File \"pydantic/fields.py\", line 808, in pydantic.fields.ModelField._create_sub_type\r\n  File \"pydantic/fields.py\", line 436, in pydantic.fields.ModelField.__init__\r\n  File \"pydantic/fields.py\", line 557, in pydantic.fields.ModelField.prepare\r\n  File \"pydantic/fields.py\", line 831, in pydantic.fields.ModelField.populate_validators\r\n  File \"pydantic/validators.py\", line 760, in find_validators\r\nRuntimeError: error checking inheritance of 'Inner' (type: str)\r\n```\r\n\r\nI've also displayed the minimal example below - thanks!\n\n### Example Code\n\n```Python\nfrom typing import Generic, List, TypeVar\r\n\r\nfrom pydantic import BaseModel\r\nfrom pydantic.generics import GenericModel\r\n\r\nChangingType = TypeVar(\"ChangingType\")\r\n\r\nclass Outer(GenericModel, Generic[ChangingType]):\r\n    fields_: list[ChangingType] # Swapping list -> List on this line fixes the bug\r\n\r\nouter = Outer[\"Inner\"]\r\nclass Inner(BaseModel):\r\n    new: list[outer]\r\n\r\nouter.update_forward_refs()\r\nInner.update_forward_refs()\r\n\r\nout = Inner.parse_obj({\"new\": [{\"fields_\": []}]})\r\n\r\nprint(out)\n```\n\n\n### Python, Pydantic & OS Version\n\n```Text\npydantic version: 1.10.9\r\npydantic compiled: True\r\ninstall path: /{package location}/.venv/lib64/python3.10/site-packages/pydantic\r\npython version: 3.10.10 (main, Feb  8 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)]\r\nplatform: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\r\noptional deps. installed: ['typing-extensions']\n```\n\n\n### Affected Components\n\n- [ ] [Compatibility between releases](https://docs.pydantic.dev/changelog/)\n- [ ] [Data validation/parsing](https://docs.pydantic.dev/usage/models/#basic-model-usage)\n- [ ] [Data serialization](https://docs.pydantic.dev/usage/exporting_models/) - `.dict()` and `.json()`\n- [ ] [JSON Schema](https://docs.pydantic.dev/usage/schema/)\n- [ ] [Dataclasses](https://docs.pydantic.dev/usage/dataclasses/)\n- [ ] [Model Config](https://docs.pydantic.dev/usage/model_config/)\n- [x] [Field Types](https://docs.pydantic.dev/usage/types/) - adding or changing a particular data type\n- [ ] [Function validation decorator](https://docs.pydantic.dev/usage/validation_decorator/)\n- [X] [Generic Models](https://docs.pydantic.dev/usage/models/#generic-models)\n- [ ] [Other Model behaviour](https://docs.pydantic.dev/usage/models/) - `construct()`, pickling, private attributes, ORM mode\n- [ ] [Plugins](https://docs.pydantic.dev/) and integration with other tools - mypy, FastAPI, python-devtools, Hypothesis, VS Code, PyCharm, etc.","author":{"url":"https://github.com/mark-todd","@type":"Person","name":"mark-todd"},"datePublished":"2023-06-14T10:26:47Z","url":"https://github.com/pydantic/pydantic/issues/6130"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:4141fae4-1e42-3987-b7e6-b909f6e6a508
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9E0E:3B2C08:343077:469F27:6AEDB266
html-safe-nonce12c7558a1f9d0dc2e7bb3b2d2719c1bb17b37364594c4409e0cf984a4871dbe1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTBFOjNCMkMwODozNDMwNzc6NDY5RjI3OjZBRURCMjY2IiwidmlzaXRvcl9pZCI6IjU4NzkxMjI4NTkxNTY5NDM0NjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac8710ca0ef4db325665b55599eeaa2ee652994e3a88656f36c2c40a62f8b2846b
hovercard-subject-tagissue:1756563021
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pydantic/pydantic/6130/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b8a1ba6c11be72b39ac0d8ab45c7010d37c9001edea769eb8460ff0b222bc872/pydantic/pydantic/issues/6130
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b8a1ba6c11be72b39ac0d8ab45c7010d37c9001edea769eb8460ff0b222bc872/pydantic/pydantic/issues/6130
og:image:altInitial Checks I have searched GitHub for a duplicate issue and I'm sure this is something new I have searched Google & StackOverflow for a solution and couldn't find anything I have read and follo...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemark-todd
hostnamegithub.com
expected-hostnamegithub.com
Nonee40242599af5e7da0f281843dec7492c322688d4a48caeea85f9fb8e41c8ea53
turbo-cache-controlno-preview
go-importgithub.com/pydantic/pydantic git https://github.com/pydantic/pydantic.git
octolytics-dimension-user_id110818415
octolytics-dimension-user_loginpydantic
octolytics-dimension-repository_id90194616
octolytics-dimension-repository_nwopydantic/pydantic
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id90194616
octolytics-dimension-repository_network_root_nwopydantic/pydantic
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release89cbf2bb52a24fc179bf5925abba0ba574b262ce
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://redirect.github.com/pydantic/pydantic/pull/6130#start-of-content
https://redirect.github.com/
Sign inhttps://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpydantic%2Fpydantic%2Fissues%2F6130
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpydantic%2Fpydantic%2Fissues%2F6130
Sign uphttps://redirect.github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=pydantic%2Fpydantic
Reloadhttps://redirect.github.com/pydantic/pydantic/pull/6130
Reloadhttps://redirect.github.com/pydantic/pydantic/pull/6130
Reloadhttps://redirect.github.com/pydantic/pydantic/pull/6130
pydantichttps://redirect.github.com/pydantic
pydantichttps://redirect.github.com/pydantic/pydantic
Codehttps://redirect.github.com/pydantic/pydantic
Issues550 (550)https://redirect.github.com/pydantic/pydantic/issues
Pull requests48 (48)https://redirect.github.com/pydantic/pydantic/pulls
Discussionshttps://redirect.github.com/pydantic/pydantic/discussions
Actionshttps://redirect.github.com/pydantic/pydantic/actions
Security and quality8 (8)https://redirect.github.com/pydantic/pydantic/security
Insightshttps://redirect.github.com/pydantic/pydantic/pulse
https://redirect.github.com/pydantic/pydantic
New issuehttps://redirect.github.com/login?return_to=https://github.com/pydantic/pydantic/issues/6130
New issuehttps://redirect.github.com/login?return_to=https://github.com/pydantic/pydantic/issues/6130
list is not equivalent to typing.List under combination of generics and futureshttps://redirect.github.com/pydantic/pydantic/issues/6130#top
bug V1Bug related to Pydantic V1.Xhttps://github.com/pydantic/pydantic/issues?q=state%3Aopen%20label%3A%22bug%20V1%22
pendingIs unconfirmedhttps://github.com/pydantic/pydantic/issues?q=state%3Aopen%20label%3A%22pending%22
https://github.com/mark-todd
mark-toddhttps://github.com/mark-todd
on Jun 14, 2023https://github.com/pydantic/pydantic/issues/6130#issue-1756563021
the docshttps://docs.pydantic.dev
FastAPIhttps://fastapi.tiangolo.com
mypyhttps://mypy.readthedocs.io/en/stable
Compatibility between releaseshttps://docs.pydantic.dev/changelog/
Data validation/parsinghttps://docs.pydantic.dev/usage/models/#basic-model-usage
Data serializationhttps://docs.pydantic.dev/usage/exporting_models/
JSON Schemahttps://docs.pydantic.dev/usage/schema/
Dataclasseshttps://docs.pydantic.dev/usage/dataclasses/
Model Confighttps://docs.pydantic.dev/usage/model_config/
Field Typeshttps://docs.pydantic.dev/usage/types/
Function validation decoratorhttps://docs.pydantic.dev/usage/validation_decorator/
Generic Modelshttps://docs.pydantic.dev/usage/models/#generic-models
Other Model behaviourhttps://docs.pydantic.dev/usage/models/
Pluginshttps://docs.pydantic.dev/
mark-toddhttps://redirect.github.com/mark-todd
bug V1Bug related to Pydantic V1.Xhttps://redirect.github.com/pydantic/pydantic/issues?q=state%3Aopen%20label%3A%22bug%20V1%22
unconfirmedhttps://redirect.github.com/pydantic/pydantic/issues?q=state%3Aopen%20label%3A%22unconfirmed%22
on Jun 14, 2023https://github.com/pydantic/pydantic/issues/6130#event-9526644398
https://redirect.github.com/mark-todd
mark-toddhttps://redirect.github.com/mark-todd
on Jun 14, 2023https://github.com/pydantic/pydantic/issues/6130#issuecomment-1591051671
https://redirect.github.com/mark-todd
mark-toddhttps://redirect.github.com/mark-todd
on Jun 14, 2023https://github.com/pydantic/pydantic/issues/6130#issuecomment-1591521848
https://github.com/pydantic/pydantic/blob/1.10.X-fixes/pydantic/typing.py#L218https://github.com/pydantic/pydantic/blob/1.10.X-fixes/pydantic/typing.py#L218
https://redirect.github.com/mark-todd
mark-toddhttps://redirect.github.com/mark-todd
on Jun 15, 2023https://github.com/pydantic/pydantic/issues/6130#issuecomment-1593293359
https://github.com/pydantic/pydantic/blob/1.10.X-fixes/pydantic/generics.py#L293https://github.com/pydantic/pydantic/blob/1.10.X-fixes/pydantic/generics.py#L293
https://redirect.github.com/mark-todd
mark-toddhttps://redirect.github.com/mark-todd
on Jun 15, 2023https://github.com/pydantic/pydantic/issues/6130#issuecomment-1593319512
https://github.com/mark-todd/pydantic/tree/generics-forward-ref-fixhttps://github.com/mark-todd/pydantic/tree/generics-forward-ref-fix
https://redirect.github.com/lig
lighttps://redirect.github.com/lig
on Sep 18, 2023https://github.com/pydantic/pydantic/issues/6130#issuecomment-1723517546
lighttps://redirect.github.com/lig
completedhttps://redirect.github.com/pydantic/pydantic/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 18, 2023https://github.com/pydantic/pydantic/issues/6130#event-10398650401
Viicoshttps://redirect.github.com/Viicos
pendingIs unconfirmedhttps://redirect.github.com/pydantic/pydantic/issues?q=state%3Aopen%20label%3A%22pending%22
unconfirmedhttps://redirect.github.com/pydantic/pydantic/issues?q=state%3Aopen%20label%3A%22unconfirmed%22
on Jan 27, 2025https://github.com/pydantic/pydantic/issues/6130#event-16075919741
Sign up for freehttps://redirect.github.com/signup?return_to=https://github.com/pydantic/pydantic/issues/6130
Sign in to commenthttps://redirect.github.com/login?return_to=https://github.com/pydantic/pydantic/issues/6130
bug V1Bug related to Pydantic V1.Xhttps://github.com/pydantic/pydantic/issues?q=state%3Aopen%20label%3A%22bug%20V1%22
pendingIs unconfirmedhttps://github.com/pydantic/pydantic/issues?q=state%3Aopen%20label%3A%22pending%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.