Skip to content

Commit

Permalink
- get rid of old compatibility code
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Sep 18, 2024
1 parent 6333579 commit 414c84f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
10 changes: 0 additions & 10 deletions src/transaction/_compat.py

This file was deleted.

11 changes: 6 additions & 5 deletions src/transaction/_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

from zope.interface import implementer

from transaction._compat import text_
from transaction._transaction import Transaction
from transaction.interfaces import AlreadyInTransaction
from transaction.interfaces import ITransactionManager
Expand Down Expand Up @@ -185,11 +184,13 @@ def run(self, func=None, tries=3):
# These are ordinarily strings, but that's
# not required. A callable class could override them
# to anything.
name = func.__name__
doc = func.__doc__
name = func.__name__ or ''
doc = func.__doc__ or ''

name = text_(name) if name else ''
doc = text_(doc) if doc else ''
if isinstance(name, bytes):
name = name.decode('UTF-8')
if isinstance(doc, bytes):
doc = doc.decode('UTF-8')

if name and name != '_':
if doc:
Expand Down
3 changes: 1 addition & 2 deletions src/transaction/tests/test__transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1697,15 +1697,14 @@ def _3():

def test_gh5(self):
from transaction import _transaction
from transaction._compat import native_

buffer = _transaction._makeTracebackBuffer()

s = 'ąčę'
buffer.write(s)

buffer.seek(0)
self.assertEqual(buffer.read(), native_(s, 'utf-8'))
self.assertEqual(buffer.read(), s)


class Resource:
Expand Down

0 comments on commit 414c84f

Please sign in to comment.