Pyside6 QLineEdit uknown empty char

48 views Asked by At

I've got a strange behavior in Python/Pyside6 QLineEdit.

Is there any ASCII char combination that QLineEdit.setText() will interpret as possible empty char ?

Could not replicate on a second run (happened only on 1 run instance a couple of times) It is also connected to random string generation (so not easy to replicate).

What I did was rand string from azAZ0-9 plus only one from a few punctuations !#$*+-.<=>@_

On on one instance I got a string that had empty space in between, something like:

AqApUn +AgAveh

I tried to copy it from QLineEdit to notepad++ to see what is it but was unable to copy - got only the first part "AqApUn" in clipboard.

My app saves the string to a DB. I closed it and rerun - and ... it only loaded the first part AqApUn only - so it seems the empty char in QLineEdit was kind of escape char?

Checked the doc and QLineEdit should not allow any Rich Text formats, plus I was not generating rich text and used only few punctuations.

Tried to do few rand cycles using + or $ or # punctuations only but could not replicate.

Sounds like a hard to reproduce /SCARY / bug. If anyone familiar with deep Python guts or Pyside6 have any idea how come such a thing can happen - let me know.

My setup is Win10, Python 3.11

The bug is somewhat similar to this one, but Im not typing the chars manually, auto generated, so no reason to get "alt+" char in there:

Pyside6 QLineEdit bug with a particular sequence of input characters

Tried to debug doing different rand cycles

1

There are 1 answers

1
Algo Lith On

I've figured this is too much malloc-like bug hence ther otehr lib I used is probably messing Python memory. I used pysecmem module which is suppose to clear string/bytes from memory and overwrite them with some \0. I have no proof (as malloc errors are not easy to replicate) but at this moment I believe this experimenta/unsafe/"forbiden" module is most probable cause of this behaviour.

Not sure what to do with the orig post - should be delete or edited?