Skip to content

Conversation

@lehenbauer
Copy link
Collaborator

Resolve discrepancies in certain floating point calculations between x86 and ARM

  • This update aligns Tohil's tclobj math behavior for both floor division (//) and remainder (%) operations with CPython, eliminating small platform-dependent calculation differences, for example between x86 and ARM. It applies consistently to expressions (e.g., a // b, a % b) and augmented assignments (e.g., a //= b, a %= b).

Use PyConfig in place of deprecated Py_SetProgramName

  • In Tohil_Init, use Python's PyConfig means of configuring the Python interpreter in place of the deprecated Py_SetProgramName.
  • Also when Tcl is the parent, use PyConfig's mechanism for telling Python not to install signal handlers.

This should be compatible with Python versions back to and including 3.8.

Remove ref to internal python type in Tohil_TD_iter_repr

  • Make Tohil_TD_iter_repr declare its proper argument type, the actual iterator type that goes with it, Tohil_TD_IterObj.
  • Conform Tohil_TD_iter_repr to reference its object using the standard "self" name for readability and consistency.

lehenbauer added 4 commits May 4, 2025 01:29
* Make Tohil_TD_iter_repr receive be proper argument, the actual iterator type that goes with it, Tohil_TD_IterObj.
* Conform Tohil_TD_iter_repr to reference its object using the standard "self" name.
* In Tohil_Init, use Python's PyConfig means of configuring the Python interpreter in place of the deprecated Py_SetProgramName.
* Also when Tcl is the parent, use the PyConfig method of telling Python not to install signal handlers.

This should work with Python versions back to and including 3.8.
Conform Tohil's behavior of tclobj python object's floor division and remainder implementations both inplace and in-calculation, to Python's way of doing it as seen in cpython/Objects/floatobject.c.
@resuna
Copy link
Member

resuna commented May 7, 2025

Probably need to modify https://github.com/flightaware/tohil/blob/main/.github/workflows/linux-ci.yml#L31 with the change in 636014c ?

@resuna
Copy link
Member

resuna commented May 16, 2025

I updated the version of python to 3.12 to work with the Ubuntu 24.04.2 runner Github is using, but one check is still failing:

Test file error: :1: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).

Investigating updating the tests to ignore this since it's a warning.

Use of datetime.datetime.utcfromtimestamp() triggers a deprecation
warning under Python 3.13.  This commit changes the call to use
datetime.datetime.fromtimestamp() instead, in accordance with the
recommendation of the deprecation warning message.
@resuna resuna merged commit 4c0f9d1 into main May 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants