manusimidt / py-xbrl

Python-based parser for parsing XBRL and iXBRL files
https://py-xbrl.readthedocs.io/en/latest/
GNU General Public License v3.0
100 stars 37 forks source link

Infinite recursion loops with cyclic taxonomy imports. #130

Closed Sam-el0 closed 1 month ago

Sam-el0 commented 3 months ago

When certain xbrl documents are parsed, it results in a:

RecursionError: maximum recursion depth exceeded while calling a Python object

From debugging, it looks like this is due to cyclic taxonomy imports. For example, in file Accounts_Bulk_Data-2024-02-24/Prod223_3641_06621976_20230331.html from @keyboardcrimp's issue [here] (https://github.com/manusimidt/py-xbrl/issues/127), the schema https://xbrl.frc.org.uk/fr/2022-01-01/core/frc-core-2022-01-01.xsd imports https://xbrl.frc.org.uk/dpl/2022-01-01/dpl-2022.xsd which imports https://xbrl.frc.org.uk/fr/2022-01-01/core/frc-core-2022-01-01.xsd, creating a infinite loop.

I quick fixed this by passing a set into the parse_taxonomy from parse_ixbrl and adding import_uris, checking that they have not already been imported. Not sure on your contribution policy but I can put in a PR.

Cheers, Sam

manusimidt commented 3 months ago

Hey @Sam-el0 , contributions via PR are always highly appreciated! :) I will also have a look into the problem

manusimidt commented 1 month ago

Hey @Sam-el0, thanks a lot for PR #133! I will have a look