Hi all,
I've spent a couple of hours trying to understand an issue I'm facing with
Pyramid 1.8.3 when I enter into an interactive pdb session. It's not clear
what happens, and even less what's causing it: I tried hard to distill a
reproducible recipe, or at least to narrow the context, but without luck.
I will try to summarize, sorry for the length and bear with me please...
It all started with the goal of "modernizing" the dependencies of an
application[1], in particular upgrading it from Pyramid 1.6 to 1.8 and from
SQLAlchemy 1.0 to 1.1. This took very little effort[4], all tests pass, and
everything seems working as expected.
Given that yesterday I noticed a minor i18n issue on the production instance,
and verified that it's still present in my unreleased/modernized version, I
tried to spot the glitch using current sources, adding a pdb.set_trace()
call at the right point and started my local instance as usual. When the
execution enters into pdb however it is immediately clear that something
strange is happening with the in/out streams: the usual pdb interactive
session begins with something like (“@” is the cursor position)
> /path/to/file.py(123)name_of_function()
-> statement_at_line_123_of_file.py
(Pdb) @
where you can enter pdb commands. In particular, I can enter into a full
interactive interpreter, something like
(Pdb) interact
*interactive*
>>> import sys
>>> print(sys.version_info)
sys.version_info(major=3, minor=6, micro=1, releaselevel='candidate',
serial=1)
>>> @
With Pyramid 1.8.3 instead the “(Pdb)” prompt is not at the right place and I
may[2] see the following
> /home/lele/wip/sol3/src/sol/models/competitor.py(184)caption()
-> if self.player1 is None:
(Pdb) > /home/lele/wip/sol3/src/sol/models/competitor.py(184)caption()
-> if self.player1 is None:
@
Effectively, it looks like *two* different interleaved sessions are going on
together, see:
interact
*interactive*
(Pdb) l
179 if player_caption is None:
180 player_caption = lambda player, h, l, cc:
player.caption(html=h, localized=l,
181
css_class=cc)
>>> 182
183 import pdb; pdb.set_trace()
184 -> if self.player1 is None:
185 return _('Player NOT assigned yet!', just_subst=not
localized)
186 else:
187 captions = [player_caption(self.player1, html, localized,
css_class)]
188 if self.player2 is not None:
189 captions.append(player_caption(self.player2, html,
localized, css_class))
@
At that point I hit the Enter key once and I get the (Pdb) prompt, another
Enter repeats the "l" command I entered above and the I get the usual ">>>"
Python prompt:
(Pdb)
190 if self.player3 is not None:
191 captions.append(player_caption(self.player3, html,
localized, css_class))
192 if self.player4 is not None:
193 captions.append(player_caption(self.player4, html,
localized, css_class))
194 return njoin(captions, localized=localized)
195
196 description = property(caption)
197
198 @property
199 def player1FullName(self):
200 "Full name of the first player"
>>> @
The "interact" here is just an example to show a different prompt, but the
very same confusion happens trying normal interactive pdb commands. Again, the
feeling is that I have *two* interactive sessions running at the same time,
contending my inputs and interleaving their output.
If I switch back to the master branch[3], reinstall its requirements.txt (thus
running with Pyramid 1.6.1, waitress 0.9.0 and no hupper) and repeat the
session, none of the above non-sense happens!
I then created a "starter" Pyramid project from scratch, but could not
reproduce the issue in any way...
I have obviously read the changelogs of Pyramid and waitress, but did not
spot anything that seems related.
Any hint on how to dig further, or shedding some light, will be highly
appreciated!
Thanks in advance,
ciao, lele.
[1] https://bitbucket.org/lele/sol
[2] “may”, because it's non-deterministic
[3] almost the same sources, different pinned requirements
[4] the only change was related to the dropped logging_file_config() function
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
[email protected] | -- Fortunato Depero, 1929.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pylons-discuss/87efxyigvr.fsf%40metapensiero.it.
For more options, visit https://groups.google.com/d/optout.