_actions.c revision 2233
591N/A * The contents of this file are subject to the terms of the 591N/A * Common Development and Distribution License (the "License"). 591N/A * You may not use this file except in compliance with the License. 591N/A * See the License for the specific language governing permissions 591N/A * and limitations under the License. 591N/A * When distributing Covered Code, include this CDDL HEADER in each 591N/A * If applicable, add the following below this CDDL HEADER, with the 591N/A * fields enclosed by brackets "[]" replaced with your own identifying 591N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2233N/A * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. 591N/A /* Shouldn't ever get here */ 591N/A * If malformed() or invalid() are used, CLEANUP_REFS can only be used 591N/A * after. Likewise, PyMem_Free(str) should not be called before using 1973N/A * malformed() or invalid(). Failure to order this properly will cause 1973N/A * corruption of the exception messages. 2457N/A * The action string is currently assumed to be a stream of bytes that 2457N/A * are valid UTF-8. This method works regardless of whether the string 591N/A * object provided is a Unicode object, string object, or a character 1846N/A * Pool attribute key to reduce memory usage and 1973N/A * potentially improve lookup performance. 591N/A * "slashmap" is a list of the positions of the 591N/A * backslashes that need to be removed from the 591N/A * final attribute string. 2233N/A * Terminate slashmap with an invalid 2233N/A * value so we don't think there's a 2233N/A * slash right at the beginning. 591N/A * Keep slashmap properly terminated so 591N/A * that a realloc()ed array doesn't give 591N/A * us random slash positions. 1890N/A * Copy the attribute from str into 591N/A * sattr, removing backslashes as 591N/A * slashmap indicates we should. 2457N/A * We need to retrieve the MalformedActionError object from pkg.actions. 2457N/A * We can't import pkg.actions directly, because that would result in a 2457N/A * circular dependency. But the "sys" module has a dict called 2457N/A * "modules" which maps loaded module names to the corresponding module 2457N/A * objects. We can then grab the exception from those objects.