Skip to content

Fix tests with python 3.13 #2216

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 7, 2025
Merged

Fix tests with python 3.13 #2216

merged 3 commits into from
Apr 7, 2025

Conversation

xrmx
Copy link
Member

@xrmx xrmx commented Feb 7, 2025

What does this pull request do?

This fixes a couple of issues regarding our send buffer handling and updates some code in order to run tests with python 3.13.

Related issues

Refs #2213

@h0rn3t
Copy link

h0rn3t commented Feb 11, 2025

same thing fix plz

@injectionsuccesfully
Copy link

injectionsuccesfully commented Feb 11, 2025

same problem 😊

@xrmx xrmx force-pushed the python3.13-support branch from 014eb7d to ad52a76 Compare April 4, 2025 10:21
@xrmx xrmx changed the title Python3.13 support Python 3.13 support Apr 4, 2025
@xrmx xrmx changed the title Python 3.13 support Fix tests with python 3.13 Apr 4, 2025
@xrmx xrmx requested a review from basepi April 4, 2025 11:10
@xrmx xrmx marked this pull request as ready for review April 4, 2025 11:10
@xrmx xrmx force-pushed the python3.13-support branch 2 times, most recently from bbfd0b7 to a69375f Compare April 4, 2025 11:15
xrmx added 2 commits April 4, 2025 17:15
With Python 3.13 our pattern of buffering revealed some issues because
the underlying BytesIO fileobj may get released before gzip.GzipFile.
This requires a fix in CPython but also some improvements on our side by
properly closing the GzipFile in case of error and also releasing the
memoryview we can from the BytesIO buffer.

These problems manifests as following warnings from unraisable exceptions
running tests:

The closing of the gzip buffer helps with:

  Traceback (most recent call last):
    File "/usr/lib/python3.13/gzip.py", line 362, in close
      fileobj.write(self.compress.flush())
      ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  ValueError: I/O operation on closed file.

Exception ignored in: <_io.BytesIO object at 0x7fbc4335fbf0>

  Traceback (most recent call last):
    File "/venv313/lib/python3.13/site-packages/ecs_logging/_stdlib.py", line 272, in _record_attribute
      def _record_attribute(

  BufferError: Existing exports of data: object cannot be re-sized

Python 3.12 shows the same warnings with the `-X dev` flag.
Handle _partialmethod moving to __partialmethod__ in Python 3.13
@xrmx xrmx force-pushed the python3.13-support branch from a69375f to 0545d16 Compare April 4, 2025 15:15
@xrmx xrmx merged commit d3d505a into elastic:main Apr 7, 2025
118 checks passed
@zffocussss
Copy link

zffocussss commented Apr 10, 2025

@xrmx Is it fixed?
we need a new release in pypi as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants