Skip to content

Two instances of MagicEncoder might share state #766

Description

@saper

This is demonstrated by the #765 test.

If I run two different MagicEncoders in a succession, the second one inherits the Encoder configuration from the first one:

            encode = MagicEncode(
                driver,
                encoder=Encoder({"CP1251": 1}),
            )
            encode.write("і is like i.")
            assert driver.output == b"\x1bt\x01\xb3 is like i."
            encode = MagicEncode(
                driver,
                encoder=Encoder({"CP855": 2}),
            )
            encode.write("і is like i.")
            assert driver.output == b"\x1bt\x02\x8a is like i."

The CP855 MagicEncoder inherits the settings from the CP1251 encoder, this is surprising. Are some data stored in the driver?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions