Skip to content

PdoBase: Forbid getting item with zero index (fixes #581) #602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

acolomb
Copy link
Member

@acolomb acolomb commented Jul 15, 2025

The PdoBase mapping uses an enumeration starting from one for the individual PDOs. Requesting index 0 (zero) accidentally will return the first PdoVariable in the first PDO. This is coincidental, because the PDOs are tried in turn and with a PDO, the numeric index lookup is zero-based.

To avoid hard-to-debug errors, simply forbid the value zero completely in the lookup, which does not make sense for any of the supported lookup methods.

@acolomb acolomb force-pushed the pdo-getitem-zero branch from feb8cf5 to 0c7606f Compare July 15, 2025 08:30
@acolomb acolomb linked an issue Jul 15, 2025 that may be closed by this pull request
@acolomb
Copy link
Member Author

acolomb commented Jul 15, 2025

Well this was meant to target v3.0, but the checks do not work seamlessly for the branch other than master. Will probably reopen to target master, but don't let that keep you from reviewing / discussion.

@acolomb acolomb added this to the v3.0.0 milestone Jul 15, 2025
@acolomb acolomb deleted the branch canopen-python:v3.0 August 5, 2025 11:21
@acolomb acolomb closed this Aug 5, 2025
@acolomb
Copy link
Member Author

acolomb commented Aug 5, 2025

Superseded by #609.

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.

PDO getitem unexpected returns PdoVariable on value 0
1 participant