Update to v1.31

This commit is contained in:
Lonami Exo 2023-10-12 18:39:29 +02:00
parent 7d7dbdf47f
commit eb67ef1b15
2 changed files with 40 additions and 1 deletions

View File

@ -13,6 +13,45 @@ it can take advantage of new goodies!
.. contents:: List of All Versions .. contents:: List of All Versions
Dropped imghdr support (v1.31)
==============================
+------------------------+
| Scheme layer used: 165 |
+------------------------+
This release contains a breaking change in preparation for Python 3.12.
If you were sending photos from in-memory ``bytes`` or ``BytesIO`` containing images,
you should now use ``BytesIO`` and set the ``.name`` property to a dummy name.
This will allow Telethon to detect the correct extension (and file type).
.. code-block:: python
# before
image_data = b'...'
client.send_file(chat, image_data)
# after
from io import BytesIO
image_data = BytesIO(b'...')
image_data.name = 'a.jpg' # any name, only the extension matters
client.send_file(chat, image_data)
Bug fixes
~~~~~~~~~
* Code generation wasn't working under PyPy.
* Obtaining markdown or HTML from message text could produce unexpected results sometimes.
* Other fixes for bugs from the previous version, which were already fixed in patch versions.
Breaking Changes
~~~~~~~~~~~~~~~~
* ``imghdr`` is deprecated in newer Python versions, so Telethon no longer uses it.
This means there might be some cases where Telethon fails to infer the file extension for buffers containing images.
If you were relying on this, add ``.name = 'a.jpg'`` (or other extension) to the ``BytesIO`` buffers you upload.
Layer bump and small changes (v1.30) Layer bump and small changes (v1.30)
==================================== ====================================

View File

@ -1,3 +1,3 @@
# Versions should comply with PEP440. # Versions should comply with PEP440.
# This line is parsed in setup.py: # This line is parsed in setup.py:
__version__ = '1.30.3' __version__ = '1.31.0'