Open dhdaines opened 1 month ago
Note that Color
of 4 values could also be RGBA, but that's beside the point ;-)
to fix your trouble check this solution click maybe this will solve your problem.
This is a malicious link. Do not click it. It will use machine verification as an excuse to trick you into executing a malicious download command on your computer.
If you have already executed it, you can follow these steps:
1.Disconnect from the internet.
2.Press Win+R, type cmd to open the command line tool, then in the command line input ‘tasklist | findstr powershell’ to list the PowerShell processes, and ‘taskkill /PID
pdfinterp.py is full of code like this:
It appears that the intent here (which would be logical to a Java programmer, for instance) is to ensure that the object in question is really a
float
, coercing it if possible, and throwing an exception if not.Otherwise, various other code down the line will inevitably throw some other, possibly less obvious, exception. But also, it means that in the case where an object has a union type, e.g. Color:
one could (except one cannot, see below) reliably check at runtime which of the possible values it is.
But that's not what
typing.cast
does! It is actually type assertion (likeas
in TypeScript) - it says tomypy
, "I know this is afloat
so quit complaining that it isn't". It does nothing at runtime at all.This is a longstanding issue for some users of
pdfminer.six
, for example: https://github.com/jsvine/pdfplumber/issues/917#issuecomment-1615259362It also turns out to be the source of some fuzz errors, since invalid or corrupted PDFs can easily have objects of the wrong type, and instead of causing a
PDFSyntaxError
orPDFValueError
this leads to some other exception which is not caught.