Aha, you were correct!  It's returning an `email.header.Header` datatype, but it's also doing this for `msg.get('Subject', '(No Subject)')` which looks like aberrant behavior since the same for `msg['To']` returns a string!

I may have to raise that as a bug with Python!  (Either that or Python on the mailman system is just old enough that that was fixed later... Python 3.10)

Either way, I'm starting to figure out what's busted here.


Thomas


On 2025-05-30 01:00, Stephen J. Turnbull wrote:
Thomas Ward via Mailman-Developers writes:

  > So, I need some information (hint: type hinting in your examples,
  > etc. would be wonderful):

Patches welcome ;-)  However, normal type hints in the examples won't
help you here.  We'd have to extract attribute references from inside
of function calls, stuff them into type-hinted variables, and use
those. Realistically, to find the type that matters to your problem
you either need to Use the Source, Luke, or RTFM.

  > (1) What is the datatype of `msg` in the archive_message class?

Ask not what is the data type of `msg`.  Ask instead what is the data
type of `msg['Subject']`.  I expect that it's `email.header.Header`.
Try `TID_PATTERN.search(str(message_subject))[0]`.

_______________________________________________
Mailman-Developers mailing list -- mailman-developers@python.org
To unsubscribe send an email to mailman-developers-le...@python.org
https://mail.python.org/mailman3/lists/mailman-developers.python.org/
Mailman FAQ: https://wiki.list.org/x/AgA3

Security Policy: https://wiki.list.org/x/QIA9

Reply via email to