Latest HyperKitty with mistune 3.0.2 rendering in plain text mode can throw KeyError.

Here's a sample traceback:

ERROR 2024-01-13 03:42:20,327 log 14452 140647888275264 Internal Server Error: /archives/list/python-ideas@python.org/message/2XSTFHYPDWW6R5DW5OX4D3EAVIWJ4JUJ/
Traceback (most recent call last):
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 56, in inner
    response = get_response(request)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/sentry_sdk/integrations/django/views.py", line 84, in sentry_wrapped_callback
    return callback(request, *args, **kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/ddtrace/contrib/trace_utils.py", line 162, in wrapper
    return func(mod, pin, wrapped, instance, args, kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/ddtrace/contrib/django/patch.py", line 213, in wrapped
    return func(*args, **kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/lib/view_helpers.py", line 137, in inner
    return func(request, *args, **kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/views/message.py", line 92, in index
    return render(request, "hyperkitty/message.html", context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/sentry_sdk/integrations/django/templates.py", line 102, in render
    return real_render(request, template_name, context, *args, **kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/shortcuts.py", line 24, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/ddtrace/contrib/trace_utils.py", line 162, in wrapper
    return func(mod, pin, wrapped, instance, args, kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/ddtrace/contrib/django/patch.py", line 351, in traced_template_render
    return wrapped(*args, **kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 175, in render
    return self._render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py", line 157, in render
    return compiled_parent._render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py", line 63, in render
    result = block.nodelist.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py", line 208, in render
    return template.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/ddtrace/contrib/trace_utils.py", line 162, in wrapper
    return func(mod, pin, wrapped, instance, args, kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/ddtrace/contrib/django/patch.py", line 351, in traced_template_render
    return wrapped(*args, **kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 177, in render
    return self._render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1064, in render
    output = self.filter_expression.resolve(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 742, in resolve
    new_obj = func(obj, *arg_vals)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/templatetags/decorate.py", line 36, in render
    return mark_safe(text_renderer(content))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/markdown.py", line 110, in __call__
    return self.parse(s)[0]
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/markdown.py", line 85, in parse
    self.block.parse(state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 168, in parse_method
    return func(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 369, in parse_block_quote
    self.parse(child, rules)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 168, in parse_method
    return func(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 369, in parse_block_quote
    self.parse(child, rules)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 168, in parse_method
    return func(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 369, in parse_block_quote
    self.parse(child, rules)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 168, in parse_method
    return func(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 369, in parse_block_quote
    self.parse(child, rules)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 168, in parse_method
    return func(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 369, in parse_block_quote
    self.parse(child, rules)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 168, in parse_method
    return func(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 369, in parse_block_quote
    self.parse(child, rules)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 167, in parse_method
    func = self._methods[m.lastgroup]
KeyError: None

And here's the content of the message:

 On Wed, 22 Jun 2022 at 08:36, Carl Meyer <carl@oddbird.net> wrote:
 >
 >
 >
 > On Tue, Jun 21, 2022 at 4:28 PM Chris Angelico <rosuav@gmail.com> wrote:
 >>
 >> On Wed, 22 Jun 2022 at 08:21, Carl Meyer via Python-ideas
 >> <python-ideas@python.org> wrote:
 >> >
 >> >
 >> >
 >> > On Tue, Jun 21, 2022 at 4:10 PM David Mertz, Ph.D. <david.mertz@gmail.com> wrote:
 >> >>
 >> >> On Tue, Jun 21, 2022 at 5:53 PM Brendan Barnwell <brenbarn@brenbarn.net> wrote:
 >> >>>
 >> >>> > In the example, we assume that the built-in function `type()` is special
 >> >>> > in not counting as a reference to the binding for purpose of realizing a
 >> >>> > computation. Alternately, some new special function like `isdeferred()` might be used to
 >> >>> > check for ``Deferred`` objects.
 >> >>>
 >> >>> I'll have to ponder my thoughts about the proposal as a whole, but this
 >> >>> particular aspect seems dubious to me.  As I understand it this would
 >> >>> require some fairly deep changes to how evaluation works in Python.
 >> >>> Right now in an expression like `type(blah)`, there isn't any way for
 >> >>> the evaluation of `blah` to depend on the fact that it happens to occur
 >> >>> as an argument to `type`.
 >> >>
 >> >>
 >> >> I absolutely agree that this is a sore point in my first draft.  I could shift the magic from `type()` to `isdeferred()`, but that doesn't really change anything for your examples.  I suppose, that is, unless `isdeferred()` becomes something other than a real function, but more like some sort of macro.  That doesn't make me happy either.
 >> >>
 >> >> However, I *would* like to be able to answer the question "Is this object a DeferredObject?" somehow.  For example, I'd like some way to write code similar to:
 >> >>
 >> >> if isdeferred(expensive_result):
 >> >>     log.debug("The computationally expensive result is not worth calculating here")
 >> >> else:
 >> >>     log.debug(f"We already hit a path that needed the result, and it is {expensive_result}")
 >> >>
 >> >> Any thoughts on what might be the least ugly way to get that?
 >> >
 >> >
 >> > I think all it really requires is for isdeferred() to be a builtin implemented in C rather than Python. It will be much better IMO to have isdeferred() returning a bool and not have any deferred object/type visible to Python.
 >> >
 >>
 >> It would have to be non-assignable and probably a keyword. Otherwise,
 >> the exact same issues will keep occurring.
 >
 >
 > Mmm, you’re right. It would either need to be handled specially in the compiler, or it would have to use the PEP 690 approach of `is_lazy_import(globals(), “name”)` where it takes both the namespace dictionary and the key as string, to avoid triggering reification.
 >
 >> What are the scoping rules for deferred objects? Do they access names
 >> where they are evaluated, or where they are defined? Consider:
 >>
 >> def f(x):
 >>     spam = 1
 >>     print(x)
 >>
 >> def g():
 >>     spam = 2
 >>     f(later spam)
 >>
 >> g()
 >>
 >> Does this print 1 or 2?
 >>
 >> This is a fundamental and crucial point, and must be settled early.
 >> You cannot defer this. :)
 >
 >
 > Yes, I agree this is a crucial point, and the answer (which is already somewhat implied by the analogy to lambdas) should be that it closes over the definition scope (just like defining a lambda or online function would.)
 >

 If that's the case, then the example of late-bound argument defaults
 simply won't work.

 ChrisA
 

The error does not occur with markdown rendering, only with plain text rendering.

Here's another traceback:

ERROR 2024-01-13 04:10:32,779 log 14452 140647888275264 Internal Server Error: /archives/list/numpy-discussion@python.org/message/6K6TUHDT3KDVWWCHHUFK5DYGXDIZXCPO/
Traceback (most recent call last):
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 56, in inner
    response = get_response(request)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/sentry_sdk/integrations/django/views.py", line 84, in sentry_wrapped_callback
    return callback(request, *args, **kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/ddtrace/contrib/trace_utils.py", line 162, in wrapper
    return func(mod, pin, wrapped, instance, args, kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/ddtrace/contrib/django/patch.py", line 213, in wrapped
    return func(*args, **kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/lib/view_helpers.py", line 137, in inner
    return func(request, *args, **kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/views/message.py", line 92, in index
    return render(request, "hyperkitty/message.html", context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/sentry_sdk/integrations/django/templates.py", line 102, in render
    return real_render(request, template_name, context, *args, **kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/shortcuts.py", line 24, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/ddtrace/contrib/trace_utils.py", line 162, in wrapper
    return func(mod, pin, wrapped, instance, args, kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/ddtrace/contrib/django/patch.py", line 351, in traced_template_render
    return wrapped(*args, **kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 175, in render
    return self._render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py", line 157, in render
    return compiled_parent._render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py", line 63, in render
    result = block.nodelist.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py", line 208, in render
    return template.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/ddtrace/contrib/trace_utils.py", line 162, in wrapper
    return func(mod, pin, wrapped, instance, args, kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/ddtrace/contrib/django/patch.py", line 351, in traced_template_render
    return wrapped(*args, **kwargs)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 177, in render
    return self._render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1064, in render
    output = self.filter_expression.resolve(context)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 742, in resolve
    new_obj = func(obj, *arg_vals)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/templatetags/decorate.py", line 36, in render
    return mark_safe(text_renderer(content))
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/markdown.py", line 110, in __call__
    return self.parse(s)[0]
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/markdown.py", line 85, in parse
    self.block.parse(state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 168, in parse_method
    return func(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 369, in parse_block_quote
    self.parse(child, rules)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 168, in parse_method
    return func(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 369, in parse_block_quote
    self.parse(child, rules)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 168, in parse_method
    return func(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 369, in parse_block_quote
    self.parse(child, rules)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 168, in parse_method
    return func(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 369, in parse_block_quote
    self.parse(child, rules)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 168, in parse_method
    return func(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 369, in parse_block_quote
    self.parse(child, rules)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 168, in parse_method
    return func(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 369, in parse_block_quote
    self.parse(child, rules)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/block_parser.py", line 446, in parse
    end_pos = self.parse_method(m, state)
  File "/opt/mailman/mm/venv/lib/python3.9/site-packages/mistune/core.py", line 167, in parse_method
    func = self._methods[m.lastgroup]
KeyError: None

and the message that caused it

 On Mon, Feb 15, 2016 at 11:05 PM, Charles R Harris <
 charlesr.harris@gmail.com> wrote:

 >
 >
 > On Mon, Feb 15, 2016 at 8:50 PM, <josef.pktd@gmail.com> wrote:
 >
 >>
 >>
 >> On Mon, Feb 15, 2016 at 10:46 PM, <josef.pktd@gmail.com> wrote:
 >>
 >>
 >>>
 >>> On Fri, Feb 12, 2016 at 4:19 PM, Nathan Goldbaum <nathan12343@gmail.com>
 >>> wrote:
 >>>
 >>>> https://github.com/numpy/numpy/blob/master/doc/release/1.11.0-notes.rst
 >>>>
 >>>> On Fri, Feb 12, 2016 at 3:17 PM, Andreas Mueller <t3kcit@gmail.com>
 >>>> wrote:
 >>>>
 >>>>> Hi.
 >>>>> Where can I find the changelog?
 >>>>> It would be good for us to know which changes are done one purpos
 >>>>> without hunting through the issue tracker.
 >>>>>
 >>>>> Thanks,
 >>>>> Andy
 >>>>>
 >>>>>
 >>>>> On 02/09/2016 09:09 PM, Charles R Harris wrote:
 >>>>>
 >>>>> Hi All,
 >>>>>
 >>>>> I'm pleased to announce the release of NumPy 1.11.0b3. This beta
 >>>>> contains additional bug fixes as well as limiting the number of
 >>>>> FutureWarnings raised by assignment to masked array slices. One issue that
 >>>>> remains to be decided is whether or not to postpone raising an error for
 >>>>> floats used as indexes. Sources may be found on Sourceforge
 >>>>> <https://sourceforge.net/projects/numpy/files/NumPy/1.11.0b3/> and
 >>>>> both sources and OS X wheels are availble on pypi. Please test, hopefully
 >>>>> this will be that last beta needed.
 >>>>>
 >>>>> As a note on problems encountered, twine uploads continue to fail for
 >>>>> me, but there are still variations to try. The wheeluploader downloaded
 >>>>> wheels as it should, but could not upload them, giving the error message
 >>>>> "HTTPError: 413 Client Error: Request Entity Too Large for url:
 >>>>> <https://www.python.org/pypi>https://www.python.org/pypi". Firefox
 >>>>> also complains that http://wheels.scipy.org is incorrectly configured
 >>>>> with an invalid certificate.
 >>>>>
 >>>>> Enjoy,
 >>>>>
 >>>>> Chuck
 >>>>>
 >>>>>
 >>>>> _______________________________________________
 >>>>> NumPy-Discussion mailing listNumPy-Discussion@scipy.orghttps://mail.scipy.org/mailman/listinfo/numpy-discussion
 >>>>>
 >>>>>
 >>>>>
 >>>>> _______________________________________________
 >>>>> NumPy-Discussion mailing list
 >>>>> NumPy-Discussion@scipy.org
 >>>>> https://mail.scipy.org/mailman/listinfo/numpy-discussion
 >>>>>
 >>>>>
 >>>>
 >>>> _______________________________________________
 >>>> NumPy-Discussion mailing list
 >>>> NumPy-Discussion@scipy.org
 >>>> https://mail.scipy.org/mailman/listinfo/numpy-discussion
 >>>>
 >>>>
 >>>
 >> (try to send again)
 >>
 >>
 >>>
 >>> another indexing question:  (not covered by unit test but showed up in
 >>> examples in statsmodels)
 >>>
 >>>
 >>> This works in numpy at least 1.9.2 and 1.6.1   (python 2.7, and python
 >>> 3.4)
 >>>
 >>> >>> list(range(5))[np.array([0])]
 >>> 0
 >>>
 >>>
 >>>
 >>> on numpy 0.11.0b2   (I'm not yet at b3)   (python 3.4)
 >>>
 >>> I get the same exception as here but even if there is just one element
 >>>
 >>>
 >>> >>> list(range(5))[np.array([0, 1])]
 >>> Traceback (most recent call last):
 >>>   File "<pyshell#7>", line 1, in <module>
 >>>     list(range(5))[np.array([0, 1])]
 >>> TypeError: only integer arrays with one element can be converted to an
 >>> index
 >>>
 >>
 > Looks like a misleading error message. Apparently it requires scalar
 > arrays (ndim == 0)
 >
 > In [3]: list(range(5))[np.array(0)]
 > Out[3]: 0
 >


 We have a newer version of essentially same function a second time that
 uses squeeze and that seems to work fine.

 Just to understand

 Why does this depend on the numpy version?  I would have understood that
 this always failed, but this code worked for several years.
 https://github.com/statsmodels/statsmodels/issues/2817

 Josef




 >
 > Chuck
 >
 > _______________________________________________
 > NumPy-Discussion mailing list
 > NumPy-Discussion@scipy.org
 > https://mail.scipy.org/mailman/listinfo/numpy-discussion
 >
 >
Edited Jan 13, 2024 by Mark Sapiro
Assignee Loading
Time tracking Loading