question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception catching failure with Python 3.7a3

See original GitHub issue

While testing Astropy with Python 3.7a3 and Numpy 1.14pre I get failures with lead me to this piece of Cython code:

        for key, val in fill_values.items():
            try:
                self.fill_values[int(key)] = val
                self.fill_values[float(key)] = val
            except (ValueError, np.ma.MaskError):
                pass

where key can be a numpy.ma.core.MaskedConstant subclass (with a __hash__ value). And I get this traceback:

Traceback (most recent call last):
  File "test.py", line 11, in <module>
    t.write('test.csv', overwrite=True)
  File "/home/simon/dev/astropy/astropy/table/table.py", line 2536, in write
    io_registry.write(self, *args, **kwargs)
  File "/home/simon/dev/astropy/astropy/io/registry.py", line 564, in write
    writer(data, *args, **kwargs)
  File "/home/simon/dev/astropy/astropy/io/ascii/connect.py", line 86, in write_csv
    return write(table, filename, **kwargs)
  File "/home/simon/dev/astropy/astropy/io/ascii/ui.py", line 880, in write
    writer.write(table, output)
  File "/home/simon/dev/astropy/astropy/io/ascii/fastbasic.py", line 194, in write
    self._write(table, output, {'fill_values': [(core.masked, '')]})
  File "/home/simon/dev/astropy/astropy/io/ascii/fastbasic.py", line 170, in _write
    writer = cparser.FastWriter(table, **write_kwargs)
SystemError: <class 'astropy.io.ascii.cparser.FastWriter'> returned NULL without setting an error

I found a number of workarounds that avoid the crash, like printing the fill_values dict before the loop, or printing a random number or str in the except clause (before pass), or maybe more interesting getting a local reference for MaskError before the loop and using except (ValueError, MaskError).

Is there a known reason for this error, which happen only with Python 3.7 ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
scodercommented, Sep 22, 2018

We are currently preparing the release of Cython 0.29, which is recommended for use with Python 3.7. Just wait another week or two.

0reactions
pllimcommented, Sep 10, 2018

Hello. Exactly which commit to master fixed this? I am curious on why this error still happens on Astropy for Cython 0.28.5. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog — gevent 22.10.3.dev0 documentation
Update the bundled libuv from 1.20.1 to 1.22.0. Test Python 3.7 on Appveyor. Fix the handling of Popen's close_fds argument on 3.7. Update ......
Read more >
Optimisation based approaches for machine learning
With the exception of such quotations, this thesis is entirely my own work. ... problems whereas problems that can handle categorical output variables...
Read more >
Last Checked - PhishCheck
URL Reputation: Unknown This URL is not identified as malicious in the PhishTank Database. Unknown PhishCheck thinks this URL is likely not a ......
Read more >
Aero-acoustic Shape Optimization of a Supersonic Business Jet
optimization problems and a detailed analysis is carried out. ... Table 3.7: A3 process distribution on the architecture available.
Read more >
Full text of "The Times , 1978, UK, English" - Internet Archive
The de¬ fects, which are said to include ' lighting failures and-possible fuel ... handling of recent espionage and bugging cases, has offered...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found