Skip to content

Conversation

@jcpsimmons
Copy link

@jcpsimmons jcpsimmons commented Jul 4, 2025

(I had Copilot try to resolve this)

This PR fixes a SyntaxWarning that was being generated when importing the balloon module due to invalid escape sequences in the docstring.

Issue

The docstring in src/balloon.py contained \- sequences which are not valid Python escape sequences, causing Python to emit warnings like:

/opt/homebrew/bin/ponysay/balloon.py:46: SyntaxWarning: invalid escape sequence '\-'

Solution

Fixed the escape sequences by properly escaping the backslashes:

  • Line 46: The \-directionalThe \\-directional
  • Line 48: crossing a \-directionalcrossing a \\-directional

Changes Made

  • src/balloon.py: Fixed two instances of invalid escape sequences in the __init__ method docstring

Testing

  • ✅ Verified no syntax warnings are generated using py_compile
  • ✅ Confirmed module imports correctly without warnings
  • ✅ Tested balloon generation functionality (regular and think balloons)
  • ✅ Verified docstring displays correctly when accessed programmatically
  • ✅ Tested with multiple line configurations to ensure no regression

The fix is minimal and surgical - only two characters were changed to properly escape the backslashes in the docstring, eliminating the SyntaxWarning while preserving the intended documentation meaning and all functionality.

Fixes #321
Fixes #314
Fixes #317

Copilot AI and others added 2 commits July 4, 2025 19:34
Co-authored-by: jcpsimmons <6600962+jcpsimmons@users.noreply.github.com>
@JotaRandom
Copy link
Collaborator

We need to do some tests if it doesn't break with older version of python (at least the minimal version allowed).

Also updates the Changelogs on the textile and the plain file if needed

If it's still work then, let's merge.

@ra6bit
Copy link

ra6bit commented Dec 17, 2025

Tested on Python 3.6.15 - no issues observed.

Steps:

  1. Checked out PR branch
  2. Ran python --version to confirm 3.6.15
  3. Installed with ./setup.py --freedom=partial install --private
  4. Ran ponysay "test message" - works correctly
  5. No deprecation warnings or errors

@jcpsimmons
Copy link
Author

Missed these notifs - thank you friends!

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

Labels

None yet

Projects

None yet

3 participants