Skip to content

Conversation

@Bibo-Joshi
Copy link
Member

@Bibo-Joshi Bibo-Joshi commented Feb 11, 2023

Supersedes #3538. Closes #3536

Checklist for PRs

  • [x] Added .. versionadded:: version, .. versionchanged:: version or .. deprecated:: version to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)
  • Created new or adapted existing unit tests
  • Documented code changes according to the CSI standard
  • Added myself alphabetically to AUTHORS.rst (optional)
  • Added new classes & modules to the docs and all suitable __all__ s

@Bibo-Joshi
Copy link
Member Author

After a bit of trial and error, I figured out that the windows test fail due to the usage of pytest-xdist. I did not investigate, why exactly that breaks it, though. Instead I chose a programatic apporach: was_called_by does a try-except and on exceptions, it logs the error and returns False.

This may give false warnings in rare cases where ApplicationBuilder was used correctly but the _was_called_by raises an exception, but I reckon that these cases are even more rare than symlinks.

The benefit of this change is that was_called_by now can never cause the code to fail - IMO this is an upside, as PTB figuring out if it should raise a warning should not be a cause for the program not running.

@Bibo-Joshi Bibo-Joshi marked this pull request as ready for review February 11, 2023 16:27
@Bibo-Joshi Bibo-Joshi changed the title Fix symlink stack Handle symlinks in was_called_by Feb 11, 2023
@hyfc
Copy link
Contributor

hyfc commented Feb 11, 2023

Good work! It looks good to me.

Copy link
Member

@Poolitzer Poolitzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a small change, such a big test :D

Code looks good!

@Bibo-Joshi Bibo-Joshi merged commit cd59c1c into master Mar 6, 2023
@Bibo-Joshi Bibo-Joshi deleted the fix-symlink-stack branch March 6, 2023 20:59
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2023
@harshil21 harshil21 added this to the v20.2 milestone Mar 25, 2023
@Bibo-Joshi Bibo-Joshi added 🔌 enhancement pr description: enhancement and removed enhancement labels Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🔌 enhancement pr description: enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] telegram.ext._utils.stack.was_called_by gives incorrect result on 64-bit machine

5 participants