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 — Python 3.13 by filmor · Pull Request #2454 · pythonnet/pythonnet

Conversation

@filmor

@filmor filmor commented Sep 19, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This is crashing right now.

  • Investigate whether the generated type offsets are correct (investigated, but missed an error, see Python 3.13 #2454 (comment))
  • Decide how to deal with the removed Getter for the thread state
  • Find out why it crashes :)

Sorry, something went wrong.

Uh oh!

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

RobPasMue, FelixSchwarz, and mpottinger reacted with thumbs up emoji
All reactions
  • 👍 3 reactions
@lostmsu

lostmsu commented Sep 19, 2024

Copy link
Copy Markdown
Member

Enable tests for 3.13 in the same PR?

All reactions

Sorry, something went wrong.

Uh oh!

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

This was referenced Oct 7, 2024
Add warning about Python 3.13 on Windows. beeware/beeware#426
Merged
Add support for Python 3.13 on Windows beeware/toga#2889
Closed
@ryan-kipawa ryan-kipawa mentioned this pull request Oct 9, 2024
Update python ceiling version to 3.13 DHI/mikeio1d#117
Merged
@filmor
filmor force-pushed the python3.13 branch from 5482dcb to 0f612b1 Compare October 25, 2024 10:11
@filmor filmor mentioned this pull request Oct 30, 2024
Python.net crashes with Python 3.13 and 3.14 #2489
Closed
@RobPasMue

RobPasMue commented Dec 10, 2024

Copy link
Copy Markdown
Contributor

@filmor @lostmsu - is there a plan for enabling support for 3.13? I see this PR has been stale for quite a while already. Just checking what's the status :)

porly1985 and dipinknair reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

@RobPasMue RobPasMue mentioned this pull request Dec 10, 2024
CHORE: Support python 3.13 ansys/pymechanical#997
Merged
@filmor

filmor commented Dec 11, 2024

Copy link
Copy Markdown
Member Author

All development is public. You can see here that the "simple" approach of adding new offsets (that I have indeed verified) fails. Debugging gave me additionally that it crashes in some very early dictionary access, but I don't really know how to go further.

RobPasMue and dipinknair reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

kunom
kunom reviewed Dec 11, 2024
View reviewed changes
Comment thread src/runtime/Runtime.Delegates.cs Resolved

Uh oh!

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

@filmor
filmor force-pushed the python3.13 branch from 80f2d56 to b1d38b3 Compare December 11, 2024 17:04
filmor added 4 commits December 11, 2024 18:12
@filmor
First attempt at Python 3.13
5cf2534
@filmor
Add Python 3.13 to CI
2f3a0e7
@filmor
Update project file
5a7b5be
@filmor
Use PyThreadState_GetUnchecked on Python 3.13
f3face0
@filmor
filmor force-pushed the python3.13 branch from b1d38b3 to f3face0 Compare December 11, 2024 17:12
@kunom

kunom commented Dec 12, 2024

Copy link
Copy Markdown

According to cvdump "c:\Program Files\Python313\python313.pdb" (cvdump from here), the PyHeapTypeStruct is stated to have a size of 928 bytes:

[...]
S_UDT:             0x1211, PyHeapTypeObject
[...]
0x1211 : Length = 58, Leaf = 0x1505 LF_STRUCTURE
	# members = 13,  field list type 0x1210, 
	Derivation list type 0x0000, VT shape type 0x0000
	Size = 928, class name = _heaptypeobject, unique name = .?AU_heaptypeobject@@, UDT(0x00001211)
[...]

However, when I look at the value of the TypeOffset313.init value, it is also 928.
image

We seem to have one property too much, don't we?

lostmsu 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.

@filmor

filmor commented Dec 12, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

Aaah, got it, thanks @kunom!

The issue is that, unlike all other members, the new tp_watched and tp_versions_used attributes are char and uint16_t. I'll update our geninterop script to pick this up and release a new version latest tomorrow (CET).

I might have to release a new version of clr-loader as well to bump the cffi dependency.

/edit: Actually, fixing the generator requires more work that I don't think is worth the effort, seeing that we should remove the direct type offsets eventually. I will just lazy-fix this by dropping one of the fields, alignment does the rest.

All reactions

Sorry, something went wrong.

Uh oh!

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

@filmor
Workaround for geninterop failure to handle non-pointer fields
88d98f2
@filmor
filmor marked this pull request as ready for review December 12, 2024 19:29
@kunom

kunom commented Dec 12, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Not shure whether this still matters, but I was finally able to produce an offset listing of the full 3.13 struct PyHeapTypeObject using Ghidra reverse engineering. According to that tool, the following struct members have a size different from 8:

Name Size
tp_flags 4
tp_version_tag 4
tp_watched 1 (as stated above)
tp_versions_used 2 (as stated above)
getitem_version 4

But as you correctly noted, due to alignment, only the tp_watched;tp_versions_used; combination matters.

All reactions

Sorry, something went wrong.

Uh oh!

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

@filmor

filmor commented Dec 12, 2024

Copy link
Copy Markdown
Member Author

On my local machine, the embedding tests also pass for 3.13. I'll have to spend some more time tomorrow to get the CI going, but I'm quite confident that I can release a new version either tomorrow or this weekend.

RobPasMue and dipinknair reacted with hooray emoji ryan-kipawa and mpottinger reacted with heart emoji
All reactions
  • 🎉 2 reactions
  • ❤️ 2 reactions

Sorry, something went wrong.

Uh oh!

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

filmor added 3 commits December 13, 2024 06:38
@filmor
Bump clr-loader and dev dependencies
4bb673f
@filmor
Raise maximum supported version
8283627
@filmor
Xfail a test that only fails locally on my machine right now
1920b19
@filmor
filmor force-pushed the python3.13 branch 3 times, most recently from 21f3ffa to 1920b19 Compare December 13, 2024 07:59
filmor added 2 commits December 13, 2024 09:06
@filmor
Skip embed tests on Python 3.13 for now
60a057f
Verified them locally, but there is an issue with the Github workflow
image that can hopefully be resolved later by using a full venv
instead of relying on the system environment.
@filmor
Add changelog entry
8f0ccb7
filmor added 2 commits December 13, 2024 09:16
@filmor
Workaround for setuptools bug #4759
7c87fec
@filmor
Remove win-x86-py3.13 entirely for now
0ea8e6f
@filmor
filmor merged commit 4132a36 into master Dec 13, 2024
@filmor
filmor deleted the python3.13 branch December 13, 2024 08:26
@lostmsu

lostmsu commented Dec 13, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Not that I'm against 3.13 support, but this seems to fail multiple tests and should have been marked alpha, or manually released calling our NuGet monthly build for preview packages, IMHO.

All reactions

Sorry, something went wrong.

Uh oh!

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

@filmor

filmor commented Dec 13, 2024

Copy link
Copy Markdown
Member Author

It is not failing tests, our CI is just a bit rusty. I ran a many combinations locally and will follow up in the next week to reactivate the excluded platforms.

dipinknair and mpottinger reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

@RobPasMue RobPasMue mentioned this pull request Jan 8, 2025
ci: properly exclude job #2542
Merged
2 of 5 tasks
@maged-hanna

maged-hanna commented Mar 3, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

@filmor I'm receiving a 'Attempted to read or write protected memory' error in my C# code when interacting with Python 3.13. This suggests potential memory corruption. Could this error be due to incompatibility with Python 3.13, or is it a sign that 3.13 is not supported?
var m_threadState = PythonEngine.BeginAllowThreads(); using (Py.GIL()){}

All reactions

Sorry, something went wrong.

Uh oh!

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

@kunom kunom mentioned this pull request Oct 31, 2025
Python 3.14 #2611
Merged
3 tasks done
@dependabot dependabot Bot mentioned this pull request Jan 16, 2026
Bump pythonnet from 3.0.3 to 3.0.5 mattemangia/Deep3DStudio#99
Closed
@dependabot dependabot Bot mentioned this pull request Nov 10, 2026
MINOR: [C#] Bump pythonnet from 3.0.4 to 3.2.1 sg-scale/arrow--apache-arrow-18.1.0#10
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@kunom kunom kunom 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

None yet

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.

5 participants

@filmor @lostmsu @RobPasMue @kunom @maged-hanna
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.