Thanks to visit codestin.com
Credit goes to github.com

Skip to content

turtle constructor incompatible with CPython: tuple expected at most 1 argument, got 2 #30

Closed
@shulltronics

Description

@shulltronics

I'm working on adopting this library to use with CPython on Generic x86 computers. When I try to use this library I get the following error:

Traceback (most recent call last):
  File "/home/carstentb/Projects/intro-to-computing/L5/benzene.py", line 20, in <module>
    start = turtle.pos()
  File "/home/carstentb/Projects/forks/Adafruit_CircuitPython_turtle/adafruit_turtle.py", line 729, in pos
    return Vec2D(self._x - self._w // 2, self._h // 2 - self._y)
TypeError: tuple expected at most 1 argument, got 2

After some Googleing, I found that for child classes of Tuple, one should use the new constructor instead of init. I implemented this and got it working for CPython (see my fork here), but that breaks it on CircuitPython! When I test my changes on a Feather nRF52840 Express from CircuitPython 7.3.1, I get this error:

Traceback (most recent call last):                                                                                    
  File "code.py", line 32, in <module>                                                                                
  File "/lib/adafruit_turtle.py", line 736, in pos                                                                    
  File "/lib/adafruit_turtle.py", line 97, in __new__                                                                 
TypeError: function takes 1 positional arguments but 2 were given

Is this an incompatibility of CircuitPython and CPython? I would love to get my changes merged in here, but obviously that can't happen if my changes break this on the CircuitPython interpreter.
I would appreciate any comments or direction on how this might be resolved. Thanks! :)

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