Changeset 2032:d36882f78aae


Ignore:
Timestamp:
Jan 27, 2021, 5:50:21 PM (10 months ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Add encoding attribute

Otherwise, the `encoding` access goes through `__getattr__`. We want
to avoid this because we would have to add `encoding` accesses to all
session scripts. Let's treat `encoding` as a regular attribute
instead, without tracking it with the session logic for expected
attribute accesses.

ticket: 143
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/scripted_session.py

    r2031 r2032  
    22# and ftputil contributors (see `doc/contributors.txt`)
    33# See the file LICENSE for licensing terms.
     4
     5import sys
    46
    57import unittest.mock
     
    108110    # to distinguish numbers like 1, 2, etc. than hexadecimal ids.
    109111    _session_count = 0
     112
     113    encoding = (
     114        "latin-1"
     115        if (sys.version_info.major, sys.version_info.minor) <= (3, 8)
     116        else "utf-8"
     117    )
    110118
    111119    @classmethod
Note: See TracChangeset for help on using the changeset viewer.