GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Pickling ClientError or ServerError returns a plain APIError · Issue #3430 · googleapis/python-genai Todo Labels priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. DescriptionEnvironment details
DescriptionAfter a pickle round trip, Exceptions are pickled whenever an error crosses a process boundary: #1144 made Steps to reproduceRuns offline. No API call is made. import pickle from concurrent.futures import ProcessPoolExecutor from google.genai import errors def call_api(): # Stands in for a client call that gets a 404 from the API. raise errors.ClientError( 404, {'error': {'code': 404, 'message': 'Not found', 'status': 'NOT_FOUND'}} ) if __name__ == '__main__': e = errors.ClientError(404, {'error': {'code': 404, 'status': 'NOT_FOUND'}}) print('after pickle:', type(pickle.loads(pickle.dumps(e))).__name__) with ProcessPoolExecutor(max_workers=1) as pool: try: pool.submit(call_api).result() except errors.ClientError: print('caught ClientError') except errors.APIError as err: print('missed ClientError, got', type(err).__name__) Expected: Actual: Root cause
return (self.__class__._rebuild, (state,)) @staticmethod def _rebuild(state: dict[str, Any]) -> 'APIError': obj = APIError.__new__(APIError)
Suggested fix: pass A tested fix with a regression test is ready on branch Activity
MetadataMetadataAssigneesLabelspriority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |